Application: using the ds5000t rtc – Maxim Integrated Secure Microcontroller User Manual

Page 167

Advertising
background image

Secure Microcontroller User’s Guide

167 of 187

the DS2251T will immediately identify this condition, if present, by the INTP being continually low.
Users of the DS2252T will recognize this condition by the

INT0

signal (pin 12) being stuck low. This is

because the RTC interrupt is internally connected to the

INT0

signal via an open-drain output. Although

external signals can drive this pin to a logic 1 state, attempts by the device to set P3.2 to a logic 1 will be
unsuccessful. This can be incorrectly interpreted as a faulty device if one is not aware of the relationship

between the RTC’s INTP pin and the

INT0

pin on the DS2251T.

Under normal usage, the alarm condition will be cleared by the application software when the RTC is set
as part of device initialization. Occasionally however, a developer may wish to clear this condition before
writing the RTC interface routine. The situation can be easily remedied by execution of the following
short program in the affected device. The following program fragment accesses the RTC, clearing the
time of day and watchdog alarm flags and disabling the associated interrupts.

Note that the breaking of the freshness seal is the only time the RTC alarm flags will be indeterminate.
Subsequent application and removal of V

CC

will have no effect on the RTC alarm bits. This situation will

never occur during normal operation.


;Program CLR_CLK.ASM
;This program clears & disables the DS2251T or DS2252T RTC alarm interrupts.

CSEG at 0 ;Reset vector.
;
START: MOV P2, #00h ;Clear high byte of address.
PUSH MCON ;Save current MCON settings.
ORL MCON, #04h ;Switch to PES to access RTC.

MOV R0, #0Bh ;Disable watchdog, TOD interrupts.
MOV A, #8Ch
MOVX @R0, A

MOV R0, #09h ;Make sure clock is enabled.
MOV A, #40h
MOVX @R0, A

MOV R0, #08h ;Disable INP force bit.
MOV A, #00h
MOVX @R0, A

MOV R0, #0Ch ;Write any value to a watchdog alarm
MOVX @R0, A ;register to clear the interrupt.

MOV R0, #03h ;Write any value to a TOD alarm
MOVX @R0, A ;register to clear the interrupt.

POP MCON ;Restore MCON settings.

Application: Using the DS5000T RTC

The RTC of the DS5000T and DS2250T is basically a serial device that uses a single address bit as an
input and a single data bus bit as an output. The following program is an example of how to use this
clock. It provides a serial port interface allowing a user to set and read the time of day. Note that the serial
port setup expects 9600-baud communication and an 11.0592MHz crystal. If a user’s application uses
different values, this setup must be modified. All of the timekeeping subroutines can be incorporated into
a user’s program by removing the command interface and serial port setup.

Advertising