312
CHAPTER 13 UART
mode 1. Set asynchronous mode, enable clock output
and serial data output.
MOV SRC,#00011101B ; Select the dedicated baud rate generator, and set the baud
rate 375 bps.
MOV SSD,#00001000B ; Disable the transmission interrupt request and enable the
reception interrupt request.
MOV A,SSD ; Required before transmission
(TDRE = 1 enables transmission)
MOV A,SIDR ; Clear error flags.
MOV SODR,#13H ; Write the data to be transmitted (13
H
).
SETI ; Enable instruction.
:
;--------------------Interrupt processing routine-----------------------------------------------------------
WARI PUSHW A ; Save A and T.
XCHW A,T
PUSHW A
MOV A,SSD ; Read the data to be transmitted, then clears the input data
flag.
MOV A,SIDR
:
User-defined process
:
POPW A ; Restore A and T.
XCHW A,T
POPW A
RETI
ENDS
; --------------------------------------------------------------------------------------------------------------------
END