Mitsubishi DS907x SIP User Manual page 155

Mitsubishi microcontroller user's guide
Table of Contents

Advertisement

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
; 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.
; 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.
; 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
MCON
equ
TA
equ
;
cseg
sjmp
cseg
START:
mov
TA,
mov
TA,
mov
PCON,
mov
MCON,
Two valid instructions, R and W,
87H
0C6H
0C7H
at
0
START
at
30H
;Initialization.
#0AAH
;Timed
#55H
;access.
#0
;Reset watchdog timer.
#0F8H
;Turn off CE2 for memory access.
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.
This allows
155
USER'S GUIDE
050396 154/173

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Ds5000tkDs5000fpDs5001fpDs5002fp

Table of Contents