;End of program.

USER'S GUIDE

POP

DPH

;Restore

the data

POP

DPL

; pointer from stack.

RET

 

;Return.

 

;

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

;*** SUBROUTINE TO WRITE A DATA BYTE ;************************************

;

;This subroutine performs a ªcontext switchº to the CE2 data

;space and then writes one byte from the accumulator to the

;timekeeping device. Then it switches back to the CE1 data

;space and returns with all registers unchanged.

;

 

 

 

 

 

WBYTE:

PUSH

DPL

 

;Save the

data

 

PUSH

DPH

 

; pointer

on stack.

 

PUSH

MCON

 

;Save the

MCON register.

 

ORL

MCON,#4

 

;Switch to CE2.

 

PUSH

B

 

;Save the

B register.

 

MOV

DPH,#0

 

;Set high

address byte.

 

 

MOV

B,

#8 ;Set the bit Count.

LO:

PUSH

ACC

 

;Save the accumulator.

 

ANL

A, #1

 

;Set up bit for output.

 

MOV

DPL,A

 

;Set address to write bit.

 

MOVX

A, @DPTR

;Output the data bit.

 

POP

ACC

 

;Restore the accumulator.

 

RR

A

 

;Position

next bit.

 

DJNZ

B, LO

 

;Loop for

a whole byte.

 

POP

B

 

;Restore the B register.

 

POP

MCON

 

;Restore the MCON register.

 

POP

DPH

 

;Restore the data

 

POP

DPL

 

; pointer

from stack.

 

RET

 

 

;Return.

 

;

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

;END OF PROGRAM ;****************

END

050396 157/173

158

Page 158
Image 158
Mitsubishi DS907x SIP, DS5000TK manual 158