USER'S GUIDE

OPEN:

LCALL

CLOSE

;Make sure it is closed.

 

MOV

B,#4

;Set pattern period

count.

 

MOV

A,#0C5H

;Load first byte of

pattern.

OPENA:

LCALL

WBYTE

;Send out the byte.

 

 

XRL

A,#0FFH

;Generate next pattern byte.

 

LCALL

WBYTE

;Send out the byte.

 

 

SWAP

A

;Generate next pattern byte.

 

DJNZ

B,OPENA

;Repeat until 8 bytes sent.

 

RET

 

;Return.

 

;

;********************************

;*** 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

B,#9

;Set up

to read 9 bytes.

CLOSEA:

LCALL

RBYTE

;Read

a

byte.

 

DJNZ

B,CLOSEA

;Loop

for 9 byte reads.

 

RET

 

;Return.

;

;***********************************

;*** 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

DPL

;Save the data

 

PUSH

DPH

; pointer on stack.

 

PUSH

MCON

;Save MCON register.

 

ORL

MCON,#4

;Switch to CE2.

 

PUSH

B

;Save the B register.

 

MOV

DPL,#4

;Set up for data input.

 

MOV

DPH,#0

;Set high address byte.

 

MOV

B,#8

;Set the bit count.

LI:

PUSH

ACC

;Save the accumulator.

 

MOVX

A,@DPTR

;Input the data bit from the RTC into

 

 

 

; ACC.7.

 

RLC

A

;Move it to carry.

 

POP

ACC

;Get the accumulator.

 

RRC

A

;Save the data bit.

 

DJNZ

B,LI

;Loop for a whole byte.

 

POP

B

;Restore the B register.

 

POP

MCON

;Restore the MCON register.

 

 

 

 

 

 

 

050396 156/173

157

Page 157
Image 157
Mitsubishi DS5000TK, DS907x SIP manual Ret, 157