Mitsubishi DS907x SIP User Manual page 157

Mitsubishi microcontroller user's guide
Table of Contents

Advertisement

OPEN:
LCALL
MOV
MOV
OPENA:
LCALL
XRL
LCALL
SWAP
DJNZ
RET
;
;********************************
;*** SUBROUTINE TO CLOSE THE RTC
;********************************
;
; This subroutine insures that the registers of the timekeeper
; are closed by executing 9 successive reads of the date and time
; registers.
The subroutine returns with both the accumulator
; and the B register modified.
;
CLOSE:
MOV
CLOSEA:
LCALL
DJNZ
RET
;
;***********************************
;*** SUBROUTINE TO READ A DATA BYTE
;***********************************
;
; This subroutine performs a "context switch: to the CE2 data
; space and then reads one byte from the timekeeping device.
; Then it switches back to the CE1 data space and returns
; the byte read in the accumulator, with all other registers
; unchanged.
;
RBYTE:
PUSH
PUSH
PUSH
ORL
PUSH
MOV
MOV
MOV
LI:
PUSH
MOVX
RLC
POP
RRC
DJNZ
POP
POP
CLOSE
;Make sure it is closed.
B,#4
;Set pattern period count.
A,#0C5H
;Load first byte of pattern.
WBYTE
;Send out the byte.
A,#0FFH
;Generate next pattern byte.
WBYTE
;Send out the byte.
A
;Generate next pattern byte.
B,OPENA
;Repeat until 8 bytes sent.
;Return.
B,#9
;Set up to read 9 bytes.
RBYTE
;Read a byte.
B,CLOSEA
;Loop for 9 byte reads.
;Return.
DPL
;Save the data
DPH
; pointer on stack.
MCON
;Save MCON register.
MCON,#4
;Switch to CE2.
B
;Save the B register.
DPL,#4
;Set up for data input.
DPH,#0
;Set high address byte.
B,#8
;Set the bit count.
ACC
;Save the accumulator.
A,@DPTR
;Input the data bit from the RTC into
; ACC.7.
A
;Move it to carry.
ACC
;Get the accumulator.
A
;Save the data bit.
B,LI
;Loop for a whole byte.
B
;Restore the B register.
MCON
;Restore the MCON register.
157
USER'S GUIDE
050396 156/173

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Ds5000tkDs5000fpDs5001fpDs5002fp

Table of Contents