Mitsubishi Motors DS5000TK User Manual

Page 158

Advertising
background image

USER’S GUIDE

050396 157/173

158

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

;End of program.

Advertising
This manual is related to the following products: