USER'S GUIDE

APPLICATION: USING THE DS5000T RTC (DS1215 EXAMPLE)

The DS5000T and DS2250T use the DS1215 Phantom Time Chip RTC. This clock 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 com- munication and an 11.0592 MHz 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.

Programmer's note: In the Write subroutine at the end of this example program, there is one unusual state- ment. The action of writing a byte to the RTC is actually done using a read instruction (MOVX A, @DPTR). This is because a write instruction would write to the RAM under CE2 if one were present. Since the DS1215 is configured to use A2 as a write enable and A0 as the data bit, this instruction is acceptable.

;Program DEMODS5T

;This program responds to commands received over the serial

;I/O port to send or receive the date/time information between

;the DS1215 in the DS5000T and the serial I/O port. This allows

;an external program or user to access the date/time information.

;The program first sets up the serial port for transmission at

;9600 baud with eight data bits, no parity, and one stop bit.

;

;Next, the program begins execution of a loop waiting for an

;instruction from the serial port. Two valid instructions, R and W,

;are recognized.

;

;Receipt of the R character causes the DEMODS5T program

;to read eight bytes of date/time information from the DS1215

;and send them out over the serial port.

;

;Receipt of the W character causes the DEMODS5T program

;to wait for eight bytes of date/time information from the serial

;port and write them to the DS1215.

;

;Any other byte received from the serial port is incremented and

;then sent back out to the serial port.

;

 

 

 

 

;

 

 

 

 

PCON

equ

87H

 

 

MCON

equ

0C6H

 

TA

equ

0C7H

 

;

 

 

 

 

 

cseg

at

0

 

 

sjmp

START

 

 

cseg

at

30H

 

START:

 

 

 

;Initialization.

mov

TA,

#0AAH

;Timed

mov

TA,

#55H

;access.

mov

PCON,

#0

 

;Reset watchdog timer.

mov

MCON,

#0F8H

;Turn off CE2 for memory access.

050396 154/173

155

Page 155
Image 155
Mitsubishi DS5000TK, DS907x SIP manual Application Using the DS5000T RTC DS1215 Example, 155