The time related judgment and time reading at the energy meter completes through the DS1302 and the AT89C51 interface. When the energy meter receives a clock correction signal, the energy meter AT89C51 writes the command word to DS1302. When determining the period, you must read the time register and the on-chip data memory of DS1302 and complete the period comparison. The user executes the period setting query. You need to read the data memory of DS1302.<br>Reading and writing all data in DS1302 is to write command words and instruct DS 1302 to read and write address units, depending on whether it is read or write. Each data transfer starts with a command byte. The most significant bit MSB (bit 7) must be logic 1. If 0, writing to DS1302 is prohibited. Bit 6 specifies the clock / calendar data of logic 0, and logic 1 specifies RAM data. Bits 1-5 specify specific registers for input or output. The LSB (bit 0) of the least significant bit is the logical 0 specifying the write operation (input), and logic 1 specifies the read operation (output).<br>DS1302 command word format<br>
正在翻译中..