Specifications
SKU: 11196125
IC RTC CLK/CALENDAR SER 8-SOIC
Parameter | Symbol | Min | Typical | Max | Unit |
---|---|---|---|---|---|
Supply Voltage | Vcc | 2.5 | - | 5.5 | V |
Data Input/Output Current | I/O | - | 1.0 | 1.5 | mA |
Clock Output Frequency | fCLK | 1.0 | - | 32.768 | kHz |
Standby Current | ISBY | 0.5 | - | 1.0 | μA |
Operating Current | IOP | 200 | - | 400 | μA |
RAM Size | - | 31 x 8 | - | bytes | |
Temperature Range | Toper | -40 | - | +85 | °C |
Instructions for Using the DS1302ZN
Power Supply:
- Connect the Vcc pin to a power supply within the range of 2.5V to 5.5V.
- Ensure the ground (GND) pin is connected to the system ground.
Data Input/Output (I/O):
- The I/O pin is used for bidirectional data communication.
- Use a pull-up resistor (typically 10kΩ) between the I/O pin and Vcc to ensure proper operation.
Clock Output (CLK):
- The CLK pin provides a 32.768 kHz clock output.
- This pin can be used to synchronize the DS1302ZN with other devices or as a clock source.
Reset (RST):
- The RST pin is used to reset the communication protocol.
- Pulling RST low for at least 500 ns will reset the DS1302ZN.
Communication Protocol:
- The DS1302ZN uses a serial interface for communication.
- The communication sequence involves sending commands and data over the I/O pin while synchronizing with the CLK pin.
- Commands include reading and writing time, date, and RAM data.
Time and Date Registers:
- The DS1302ZN has registers for seconds, minutes, hours, day, date, month, and year.
- These registers can be read from or written to using specific command sequences.
RAM Usage:
- The DS1302ZN includes 31 bytes of RAM, which can be used for general-purpose data storage.
- Access the RAM by addressing the appropriate register locations.
Power Management:
- The DS1302ZN has a low-power mode to minimize current consumption.
- In standby mode, the current consumption is typically 0.5 μA to 1.0 μA.
Temperature Considerations:
- The DS1302ZN operates reliably over a temperature range from -40°C to +85°C.
- Ensure the device is not exposed to temperatures outside this range to avoid damage or inaccurate readings.
Programming Example:
- To set the time:
// Example in C void set_time(uint8_t sec, uint8_t min, uint8_t hour) { uint8_t cmd = 0x8E; // Command to write to seconds register uint8_t data[3] = {bcd_encode(sec), bcd_encode(min), bcd_encode(hour)}; ds1302_write(cmd, data, 3); } void ds1302_write(uint8_t cmd, uint8_t *data, uint8_t len) { // Implement the write function to send the command and data } uint8_t bcd_encode(uint8_t value) { return (value / 10) << 4 | (value % 10); }
- To set the time:
Reading Time:
- To read the time:
void get_time(uint8_t *sec, uint8_t *min, uint8_t *hour) { uint8_t cmd = 0x8F; // Command to read from seconds register uint8_t data[3]; ds1302_read(cmd, data, 3); *sec = bcd_decode(data[0]); *min = bcd_decode(data[1]); *hour = bcd_decode(data[2]); } void ds1302_read(uint8_t cmd, uint8_t *data, uint8_t len) { // Implement the read function to receive the data } uint8_t bcd_decode(uint8_t value) { return (value >> 4) * 10 + (value & 0x0F); }
- To read the time:
By following these instructions, you can effectively use the DS1302ZN real-time clock (RTC) in your projects.
(For reference only)Inquiry - DS1302ZN