Freelance Electronics Components Distributor
Closed Dec 25th-26th
800-300-1968
We Stock Hard to Find Parts

C8051F041-GQ

Part # C8051F041-GQ
Description MCU 8BIT CISC 64KB FLASH 3V 64TQFP - Trays
Category IC
Availability In Stock
Qty 2
Qty Price
1 + $20.05559
Manufacturer Available Qty
SILICON LABORATORIES
Date Code: 0903
  • Shipping Freelance Stock: 2
    Ships Immediately



Technical Document


DISCLAIMER: The information provided herein is solely for informational purposes. Customers must be aware of the suitability of this product for their application, and consider that variable factors such as Manufacturer, Product Category, Date Codes, Pictures and Descriptions may differ from available inventory.

C8051F040/1/2/3/4/5/6/7
Rev. 1.5 265
21. UART0
UART0 is an enhanced serial port with frame error detection and address recognition hardware. UART0
may operate in full-duplex asynchronous or half-duplex synchronous modes, and mutiproccessor commu-
nication is fully supported. Receive data is buffered in a holding register, allowing UART0 to start reception
of a second incoming data byte before software has finished reading the previous data byte. A Receive
Overrun bit indicates when new received data is latched into the receive buffer before the previously
received byte has been read.
UART0 is accessed via its associated SFRs, Serial Control (SCON0) and Serial Data Buffer (SBUF0). The
single SBUF0 location provides access to both transmit and receive registers. Reading SCON0 accesses
the Receive register and writing SCON0 accesses the Transmit register.
UART0 may be operated in polled or interrupt mode. UART0 has two sources of interrupts: a Transmit
Interrupt flag, TI0 (SCON0.1) set when transmission of a data byte is complete, and a Receive Interrupt
flag, RI0 (SCON0.0) set when reception of a data byte is complete. UART0 interrupt flags are not cleared
by hardware when the CPU vectors to the interrupt service routine; they must be cleared manually by soft-
ware. This allows software to determine the cause of the UART0 interrupt (transmit complete or receive
complete).
Figure 21.1. UART0 Block Diagram
Tx Control
Tx Clock
Tx IRQ
Zero Detector
Send
Shift
SET
QD
CLR
Stop Bit
Gen.
TB80
Start
Data
Write to
SBUF0
Crossbar
TX0
Port I/O
Serial Port
(UART0) Interrupt
Rx Control
Start
Rx Clock
Load
SBUF
0x1FFShift
EN Rx IRQ
UART0
Baud Rate Generation
Logic
SFR Bus
Input Shift Register
(9 bits)
Frame Error
Detection
SBUF0
Read
SBUF0
SFR Bus
SADDR0
SADEN0
Match Detect
RB80
Load
SBUF0
Crossbar
RX0
SBUF0
Address
Match
SCON0
S
M
2
0
T
B
8
0
R
B
8
0
T
I
0
R
I
0
S
M
1
0
S
M
0
0
R
E
N
0
SSTA0
T
X
C
O
L
0
S
0
T
C
L
K
1
S
0
T
C
L
K
1
S
0
R
C
L
K
1
S
0
R
C
L
K
1
R
X
O
V
0
F
E
0
S
M
O
D
0
TI0
RI0
C8051F040/1/2/3/4/5/6/7
266 Rev. 1.5
21.1. UART0 Operational Modes
UART0 provides four operating modes (one synchronous and three asynchronous) selected by setting
configuration bits in the SCON0 register. These four modes offer different baud rates and communication
protocols. The four modes are summarized in Table 21.1.
21.1.1. Mode 0: Synchronous Mode
Mode 0 provides synchronous, half-duplex communication. Serial data is transmitted and received on the
RX0 pin. The TX0 pin provides the shift clock for both transmit and receive. The MCU must be the master
since it generates the shift clock for transmission in both directions (see the interconnect diagram in
Figure 21.3).
Data transmission begins when an instruction writes a data byte to the SBUF0 register. Eight data bits are
transferred LSB first (see the timing diagram in Figure 21.2), and the TI0 Transmit Interrupt Flag
(SCON0.1) is set at the end of the eighth bit time. Data reception begins when the REN0 Receive Enable
bit (SCON0.4) is set to logic 1 and the RI0 Receive Interrupt Flag (SCON0.0) is cleared. One cycle after
the eighth bit is shifted in, the RI0 flag is set and reception stops until software clears the RI0 bit. An inter-
rupt will occur if enabled when either TI0 or RI0 are set.
The Mode 0 baud rate is SYSCLK/12. RX0 is forced to open-drain in Mode 0, and an external pullup will
typically be required.
Figure 21.2. UART0 Mode 0 Timing Diagram
Table 21.1. UART0 Modes
Mode Synchronization Baud Clock Data Bits Start/Stop Bits
0 Synchronous SYSCLK / 12 8 None
1 Asynchronous Timer 1, 2, 3, or 4 Overflow 8 1 Start, 1 Stop
2 Asynchronous SYSCLK / 32 or SYSCLK / 64 9 1 Start, 1 Stop
3 Asynchronous Timer 1, 2, 3, or 4 Overflow 9 1 Start, 1 Stop
D1D0 D2 D3 D4 D5 D6 D7
RX (data out)
MODE 0 TRANSMIT
D0
MODE 0 RECEIVE
RX (data in)
D1 D2 D3 D4 D5 D6 D7
TX (clk out)
TX (clk out)
Shift
Reg.
CLK
C8051Fxxx
RX
TX
DATA
8 Extra Outputs
C8051F040/1/2/3/4/5/6/7
Rev. 1.5 267
Figure 21.3. UART0 Mode 0 Interconnect
21.1.2. Mode 1: 8-Bit UART, Variable Baud Rate
Mode 1 provides standard asynchronous, full-duplex communication using a total of 10 bits per data byte:
one start bit, eight data bits (LSB first), and one stop bit. Data are transmitted from the TX0 pin and
received at the RX0 pin. On receive, the eight data bits are stored in SBUF0 and the stop bit goes into
RB80 (SCON0.2).
Data transmission begins when an instruction writes a data byte to the SBUF0 register. The TI0 Transmit
Interrupt Flag (SCON0.1) is set at the end of the transmission (the beginning of the stop-bit time). Data
reception can begin any time after the REN0 Receive Enable bit (SCON0.4) is set to logic 1. After the stop
bit is received, the data byte will be loaded into the SBUF0 receive register if the following conditions are
met: RI0 must be logic 0, and if SM20 is logic 1, the stop bit must be logic 1.
If these conditions are met, the eight bits of data is stored in SBUF0, the stop bit is stored in RB80 and the
RI0 flag is set. If these conditions are not met, SBUF0 and RB80 will not be loaded and the RI0 flag will not
be set. An interrupt will occur if enabled when either TI0 or RI0 are set.
Figure 21.4. UART0 Mode 1 Timing Diagram
The baud rate generated in Mode 1 is a function of timer overflow, shown in Equation 21.1 and
Equation 21.3. UART0 can use Timer 1 operating in 8-Bit Auto-Reload Mode, or Timer 2, 3, or 4 operating
in Auto-reload Mode to generate the baud rate (note that the TX and RX clocks are selected separately).
On each timer overflow event (a rollover from all ones—0xFF for Timer 1, 0xFFFF for Timers 2, 3 and 4—
to zero) a clock is sent to the baud rate logic.
Timers 1, 2, 3, and 4 are selected as the baud rate source with bits in the SSTA0 register (see SFR Defini-
tion 21.2). The transmit baud rate clock is selected using the S0TCLK1 and S0TCLK0 bits, and the receive
baud rate clock is selected using the S0RCLK1 and S0RCLK0 bits.
The Mode 1 baud rate equations are shown below, where T1M is bit4 of register CKCON, TH1 is the 8-bit
reload register for Timer 1, and [RCAPnH, RCAPnL] is the 16-bit reload register for Timer 2, 3, or 4.
Equation 21.1. Mode 1 Baud Rate using Timer 1
The Timer 1 overflow rate is determined by the Timer 1 clock source (T1CLK) and reload value (TH1). The
frequency of T1CLK is selected as described in Section “23.1. Timer 0 and Timer 1” on page 287. The
Timer 1 overflow rate is calculated as shown in Equation 21.2.
D1D0 D2 D3 D4 D5 D6 D7
START
BIT
MARK
STOP
BIT
BIT TIMES
BIT SAMPLING
SPACE
Mode1_BaudRate 1 32 Timer1_OverflowRate=
When SMOD0 = 0:
Mode1_BaudRate 1 16 Timer1_OverflowRate=
When SMOD0 = 1:
PREVIOUS8283848586878889909192939495NEXT