circuitcellar.com
Magazine Support   Digital Library   Products & Services   Suppliers Directory 
 
 





 

Issue 140 March 2002
Spy-Size Event Logger

 


byJeff Bachiochi

RTC Group

The RTC group is similar to many other real-time clocks in which the data is held in BCD format. The 2000-compliant century register correctly notes the year 2000 as a leap year. Although we’re well past 2000, having the century available makes date handling safe for all of those programs that had to translate a two-digit year into the correct century.

The most complicated configuration to understand is military versus standard time. The upper-nibble BCD digit of the hour can never be greater than 2 (00–23 in military time) and never greater than 1 (01–12 in standard time). So bit 6 always can be used to indicate military time or standard time. It indicates military time when set and standard time when cleared.

When this bit is set, the hours will rollover after 23:59:59, as opposed to standard time, which rolls over after 11:59:59. If bit 6 is cleared (standard time), then bit 5 is available to indicate a.m. or p.m. When bit 6 is cleared, bit 5 indicates p.m. when set and a.m. when cleared. Remember that most RTCs will not validate the data you write as legal, so it’s possible to set an illegal mode/time such as 20:00:00 standard time (which is 10 p.m., not the equivalent standard time of 8 p.m.).

Just above the RTC data registers 00–07 are the RTC alarm registers. An alarm can be generated whenever a match occurs on all registers with their alarm bit (bit 7) cleared. If registers 08–11 have bit 7 cleared, then an alarm will be generated every week on a match of the seconds registers (00 and 08), minutes registers (01 and 09), hours registers (02 and 10), and DOW registers (03 and 11).

When bit 7 of any alarm registers 08–11 is set, the action specifies a "don’t care" condition for that register. This means that you can get an alarm state once a week, once a day, once an hour, once a minute, or once a second (if all four registers have the alarm bit 7 set). When in Alarm mode, the INT pin is configured as an output and will go low until reset or when you access any of the alarm registers.

Configuration and status registers complete the RTC group. The control registers configure the DS1678’s mode. Figure 4 and Table 1 provide the operating modes and status of the DS1678.

(Click here to enlarge)

Figure 4—Configuration bits establish the operating mode of the DS1678.

 

Table 1—Status bits reflect the state of the D1678. Interaction between this status register and the control register (see Figure 4) protects the device from unintentional operations.