CHAPTER 18 UART
18.9 Example of UART Programming
18.9
Example of UART Programming
This section provides program example for UART.
■ Example of UART Programming
●
Processing specification
Perform serial transmission/reception using the bidirectional communication function (normal mode) of the
UART.
Defined as: Operation mode 0, asynchronous, 8 bits of data length, 2 bits of stop bit length, without parity.
Use the P42/SIN0, P43/SOT0 pins for communication.
The baud rate is set to about 9600 bps using the dedicated baud rate generator.
Send character "13
Set the machine clock (φ) to 16 MHz.
●
Coding example
ICR14
DDR4
SMR0
SCR0
SIDR0
SODR0
SSR0
UTCR0
UTRLR0
REC
;----------Main Program------------------------------------------------------------
CODE
START:
;
428
" from the SOT0 pin to receive using an interrupt.
H
EQU
0000BEH
EQU
000014H
EQU
000020H
EQU
000021H
EQU
000022H
EQU
000022H
EQU
000023H
EQU
000025H
EQU
000024H
EQU
SCR:2
CSEG
ABS = 0FFH
:
AND
CCR,#0BFH
MOV
I:ICR14, #00H
MOV
I:DDR4, #00000000B
MOV
I:SMR0, #00000001B
MOV
I:UTRL0#81A0H
FUJITSU MICROELECTRONICS LIMITED
MB90335 Series
; UART send/receive interrupt control register.
; Port 4 direction register 0
; Serial mode register 0
; Serial control register 0
; Serial input data register 0
; Serial output data register 0
; Serial Status Register 0
; UART prescaler control register 0
; UART prescaler reload register 0
; Receive error flag clear bit
; Initialize such as a stack pointer (SP).
; Defined as done.
; Disables the interrupt.
; Interrupt levels 0 (strength)
; Sets the SIN0 pin for input.
; operation mode 0 (asynchronous)
; Disables the clock output and enables the data
; output.
; uses Dedicated baud rate generator
; (9615bps Selection)
CM44-10137-6E