SN8P2977
8-Bit Micro-Controller with Regulator, PGIA, 24-bit ADC
SONiX TECHNOLOGY CO., LTD
Page 92
Version 1.7
9.9 UART OPERATION EXAMLPE
UART TX Configuration:
; Select parity bit function.
B0BCLR
FUTXPEN
; Disable UART TX parity bit function.
;or
B0BSET
FUTXPEN
; Enable UART TX parity bit function.
; Select parity bit format.
B0BCLR
FUTXPS
; UART TX parity bit format is even parity.
;or
B0BSET
FUTXPS
; UART TX parity bit format is odd parity.
; Set UART baud rate.
MOV
A, #
value1
; Set UART pre-scaler URS[2:0].
B0MOV
URRX, A
MOV
A, #
value2
; Set UART baud rate 8-bit buffer.
B0MOV
URCR, A
; Enable UART TX pin.
B0BSET
FUTXEN
; Enable UART TX function and UART TX pin.
; Enable UART TX interrupt function.
B0BCLR
FUTXIRQ
; Clear UART TX interrupt flag.
B0BSET
FUTXIEN
; Enable UART TX interrupt function.
; Load TX data buffer and execute TX transmitter.
MOV
A, #
value3
; Load 8-bit data to UTXD data buffer.
B0MOV
UTXD, A
;After loading UTXD, UART TX starts to transmit.
NOP
; One instruction delay for UTXBZ flag.
; Check TX operation.
B0BTS0
FUTXBZ
; Check UTXBZ bit.
JMP
CHKTX
; UTXBZ=1, TX is operating.
JMP
ENDTX
; UTXBZ=0, the end of TX.
Note: UART TX operation is started through loading UTXD data buffer.