USER'S GUIDE

APPLICATION: USING THE DS2251T RTC (DS1283 EXAMPLE)

The DS2251T or DS2252T use the DS1283 Byte±wide type real±time clock (RTC). This clock is accessed in a parallel fashion like a RAM. The user simply writes to the registers to set the time and control functions. The fol- lowing program is an example of how to use this clock. It provides a serial port interface allowing an user to set

and read the time of day. Note that the serial port setup expects 9600 baud communication and an 11.0592 MHz crystal. If a user's application uses different val- ues, this setup must be modified. All of the timekeeping access is performed in the code under Set Time and Tell Time. The remainder of this program concerns getting data in and out of the serial port for display purposes and has nothing to do with timekeeper access.

;Program DS1283

;This program responds to commands received over the serial

;port to set the date and time information in the DS1283

;

;The program first initializes the serial port for communication

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

;After setting the date and time, the program begins execution

;of an infinite loop which sends back the date and time each

;time a character is received.

;

 

 

 

 

 

CR

EQU

0DH

 

 

 

LF

EQU

0AH

 

 

 

;

 

 

 

 

 

MCON

EQU

0C6H

 

 

 

TA

EQU

0C7H

 

 

 

 

CSEG

AT

0

 

 

;

 

 

 

 

 

 

MOV

TA,

#0AAH

; Timed

 

MOV

TA,

#55H

;

access.

 

MOV

PCON,

#0

; Reset watchdog timer.

 

ANL

MCON,

#0FBH

; Turn off PES for memory access.

 

MOV

P2,

#0

; Clear high byte of address.

 

 

 

;

for clock access

;

 

 

 

 

 

 

MOV

IE,

#0

 

 

 

MOV

TMOD,

#20H

; Initialize the

 

MOV

TH1,

#0FAH

;

serial port

 

MOV

TL1,

#0FAH

;

for 9600

 

ORL

PCON,

#80H

;

baud, with 11.0522 MHz crystal.

 

MOV

SCON,

#52H

 

 

 

MOV

TCON,

#40H

 

 

;Messages

 

 

 

 

 

 

MOV

DPTR,

#TEXT0

 

 

 

LCALL

TEXT_OUT

 

 

 

 

LCALL

CHAR_IN

 

 

 

 

LCALL

CHAR_OUT

 

 

 

 

PUSH

ACC

 

 

 

 

MOV

DPTR,

#TEXT3

 

 

 

LCALL

TEXT_OUT

 

 

 

 

POP

ACC

 

 

 

 

ANL

A,

#5FH

 

 

 

CJNE

A, #'Y',

TELL_TIME

 

 

050396 158/173

159

Page 159
Image 159
Mitsubishi DS5000TK, DS907x SIP manual Application Using the DS2251T RTC DS1283 Example, 159