mg84fl54 Megawin Technology, mg84fl54 Datasheet - Page 40

no-image

mg84fl54

Manufacturer Part Number
mg84fl54
Description
Full-speed Usb Micro-controller
Manufacturer
Megawin Technology
Datasheet
12. Serial Port (UART)
The serial port of MG84FL54B support full-duplex transmission, meaning it can transmit and receive
simultaneously. It is also receive-buffered, meaning it can commence reception of a second byte before a
previously received byte has been read from the register. However, if the first byte still hasn’t been read by the
time reception of the second byte is complete, one of the bytes will be lost. The serial port receive and transmit
registers are both accessed at special function register SBUF. Writing to SBUF loads the transmit register, and
reading from SBUF accesses a physically separate receive register.
The serial port can operate in 4 modes: Mode 0 provides synchronous communication while Modes 1, 2, and 3
provide asynchronous communication. The asynchronous communication operates as a full-duplex Universal
Asynchronous Receiver and Transmitter (UART), which can transmit and receive simultaneously and at
different baud rates.
Mode 0: 8 data bits (LSB first) are transmitted or received through RXD(P3.0). TXD(P3.1) always outputs the
shift clock. The baud rate can be selected to 1/12 or 1/2 the system clock frequency by URM0X6 setting in
AUXR2 register.
Mode 1: 10 bits are transmitted through TXD or received through RXD. The frame data includes a start bit (0), 8
data bits (LSB first), and a stop bit (1), as shown in Fig 12-1 . On receive, the stop bit would be loaded into RB8
in SCON register. The baud rate is variable.
Fig 12-1 Mode 1 Data Frame
Mode 2: 11 bits are transmitted through TXD or received through RXD. The frame data includes a start bit (0), 8
data bits (LSB first), a programmable 9th data bit, and a stop bit (1), as shown in Fig 12-2. On Transmit, the 9th
data bit comes from TB8 in SCON register can be assigned the value of 0 or 1. On receive, the 9th data bit
would be loaded into RB8 in SCON register, while the stop bit is ignored. The baud rate can be configured to
1/32 or 1/64 the system clock frequency.
Fig 12-2 Mode 2, 3 Data Frame
Mode 3: Mode 3 is the same as Mode 2 except the baud rate is variable.
In all four modes, transmission is initiated by any instruction that uses SBUF as a destination register. In Mode 0,
reception is initiated by the condition RI=0 and REN=1. In the other modes, reception is initiated by the incoming
start bit with 1-to-0 transition if REN=1.
In addition to the standard operation, the UART can perform framing error detection by looking for missing stop
bits, and automatic address recognition.
12.1. Mode 0
40
Mode 2, 3
Mode 1
Start
Start
D0
D0
D1
D1
MG84FL54B Data Sheet
D2
D2
D3
D3
8-bit data
9-bit data
D4
D4
D5
D5
D6
D6
D7
D7
D8
Stop
Stop
MEGAWIN

Related parts for mg84fl54