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 277
22. UART1
UART1 is an asynchronous, full duplex serial port offering modes 1 and 3 of the standard 8051 UART.
Enhanced baud rate support allows a wide range of clock sources to generate standard baud rates (details
in Section “22.1. Enhanced Baud Rate Generation” on page 278). Received data buffering allows
UART1 to start reception of a second incoming data byte before software has finished reading the previous
data byte.
UART1 has two associated SFRs: Serial Control Register 1 (SCON1) and Serial Data Buffer 1 (SBUF1).
The single SBUF1 location provides access to both transmit and receive registers. Reading SBUF1
accesses the buffered Receive register; writing SBUF1 accesses the Transmit register.
With UART1 interrupts enabled, an interrupt is generated each time a transmit is completed (TI1 is set in
SCON1), or a data byte has been received (RI1 is set in SCON1). The UART1 interrupt flags are not
cleared by hardware when the CPU vectors to the interrupt service routine. They must be cleared manually
by software, allowing software to determine the cause of the UART1 interrupt (transmit complete or receive
complete).
Figure 22.1. UART1 Block Diagram
UART1 Baud
Rate Generator
RI1
SCON1
RI1
TI1
RB81
TB81
REN1
MCE1
S1MODE
Tx Control
Tx Clock
Send
SBUF1
(TX Shift)
Start
Data
Write to
SBUF1
Crossbar
TX1
Shift
Zero Detector
Tx IRQ
SET
QD
CLR
Stop Bit
TB81
SFR Bus
Serial
Port
Interrupt
TI1
Port I/O
Rx Control
Start
Rx Clock
Load
SBUF1
Shift 0x1FF RB81
Rx IRQ
Input Shift Register
(9 bits)
Load SBUF1
Read
SBUF1
SFR Bus
Crossbar
RX1
SBUF1
(RX Latch)
C8051F040/1/2/3/4/5/6/7
278 Rev. 1.5
22.1. Enhanced Baud Rate Generation
The UART1 baud rate is generated by Timer 1 in 8-bit auto-reload mode. The TX clock is generated by
TL1; the RX clock is generated by a copy of TL1 (shown as RX Timer in Figure 22.2), which is not user-
accessible. Both TX and RX Timer overflows are divided by two to generate the TX and RX baud rates.
The RX Timer runs when Timer 1 is enabled, and uses the same reload value (TH1). However, an
RX Timer reload is forced when a START condition is detected on the RX pin. This allows a receive to
begin any time a START is detected, independent of the TX Timer state.
Figure 22.2. UART1 Baud Rate Logic
Timer 1 should be configured for Mode 2, 8-bit auto-reload (see Section “23.1.3. Mode 2: 8-bit Counter/
Timer with Auto-Reload” on page 289). The Timer 1 reload value should be set so that overflows will
occur at two times the desired baud rate. Note that Timer 1 may be clocked by one of five sources: SYS-
CLK, SYSCLK / 4, SYSCLK / 12, SYSCLK / 48, or the external oscillator clock / 8. For any given Timer 1
clock source, the UART1 baud rate is determined by Equation 22.1, where T1
CLK
is the frequency of the
clock supplied to Timer 1, and TH1 is the high byte of Timer 1 (reload value).
Equation 22.1. UART1 Baud Rate
Timer 1 clock frequency is selected as described in Section “23.1. Timer 0 and Timer 1” on page 287. A
quick reference for typical baud rates and system clock frequencies is given in Table 22.1 through
Table 22.6. Note that the internal oscillator may still generate the system clock when the external oscillator
is driving Timer 1 (see Section “23.1. Timer 0 and Timer 1” on page 287 for more details).
RX Timer
Start
Detected
Overflow
Overflow
TH1
TL1
TX Clock
2
RX Clock
2
Timer 1 UART1
UartBaudRate
T1
CLK
256 TH1
-------------------------------
1
2
---
=
C8051F040/1/2/3/4/5/6/7
Rev. 1.5 279
22.2. Operational Modes
UART1 provides standard asynchronous, full duplex communication. The UART mode (8-bit or 9-bit) is
selected by the S1MODE bit (SCON1.7). Typical UART connection options are shown below.
Figure 22.3. UART Interconnect Diagram
22.2.1. 8-Bit UART
8-Bit UART mode uses a total of 10 bits per data byte: one start bit, eight data bits (LSB first), and one stop
bit. Data are transmitted LSB first from the TX1 pin and received at the RX1 pin. On receive, the eight data
bits are stored in SBUF1 and the stop bit goes into RB81 (SCON1.2).
Data transmission begins when software writes a data byte to the SBUF1 register. The TI1 Transmit Inter-
rupt Flag (SCON1.1) is set at the end of the transmission (the beginning of the stop-bit time). Data recep-
tion can begin any time after the REN1 Receive Enable bit (SCON1.4) is set to logic 1. After the stop bit is
received, the data byte will be loaded into the SBUF1 receive register if the following conditions are met:
RI1 must be logic 0, and if MCE1 is logic 1, the stop bit must be logic 1. In the event of a receive data over-
run, the first received 8 bits are latched into the SBUF1 receive register and the following overrun data bits
are lost.
If these conditions are met, the eight bits of data is stored in SBUF1, the stop bit is stored in RB81 and the
RI1 flag is set. If these conditions are not met, SBUF1 and RB81 will not be loaded and the RI1 flag will not
be set. An interrupt will occur if enabled when either TI1 or RI1 is set.
Figure 22.4. 8-Bit UART Timing Diagram
OR
RS-232
C8051Fxxx
RS-232
LEVEL
XLTR
TX
RX
C8051Fxxx
RX
TX
MCU
RX
TX
D1D0 D2 D3 D4 D5 D6 D7
START
BIT
MARK
STOP
BIT
BIT TIMES
BIT SAMPLING
SPACE
PREVIOUS8687888990919293949596979899NEXT