English
Language : 

PIC24F04KA201 Datasheet, PDF (136/224 Pages) Microchip Technology – 14/20-Pin General Purpose, 16-Bit Flash Microcontrollers with nanoWatt XLP™ Technology
PIC24F04KA201 FAMILY
17.1 UART Baud Rate Generator (BRG)
The UART module includes a dedicated 16-bit Baud
Rate Generator (BRG). The U1BRG register controls
the period of a free-running, 16-bit timer. Equation 17-1
provides the formula for computation of the baud rate
with BRGH = 0.
EQUATION 17-1: UART BAUD RATE WITH
BRGH = 0(1)
Baud Rate =
FCY
16 • (U1BRG + 1)
U1BRG =
FCY
–1
16 • Baud Rate
Note 1: Based on FCY = FOSC/2, Doze mode
and PLL are disabled.
Example 17-1 provides the calculation of the baud rate
error for the following conditions:
• FCY = 4 MHz
• Desired Baud Rate = 9600
The maximum baud rate (BRGH = 0) possible is
FCY/16 (for U1BRG = 0) and the minimum baud rate
possible is FCY/(16 * 65536).
Equation 17-2 provides the formula for computation of
the baud rate with BRGH = 1.
EQUATION 17-2: UART BAUD RATE WITH
BRGH = 1(1)
Baud Rate =
FCY
4 • (U1BRG + 1)
U1BRG =
FCY
–1
4 • Baud Rate
Note 1: Based on FCY = FOSC/2, Doze mode
and PLL are disabled.
The maximum baud rate (BRGH = 1) possible is FCY/4
(for U1BRG = 0) and the minimum baud rate possible
is FCY/(4 * 65536).
Writing a new value to the U1BRG register causes the
BRG timer to be reset (cleared). This ensures the BRG
does not wait for a timer overflow before generating the
new baud rate.
EXAMPLE 17-1: BAUD RATE ERROR CALCULATION (BRGH = 0)(1)
Desired Baud Rate = FCY/(16 (U1BRG + 1))
Solving for UxBRG value:
U1BRG
U1BRG
U1BRG
= ((FCY/Desired Baud Rate)/16) – 1
= ((4000000/9600)/16) – 1
= 25
Calculated Baud Rate = 4000000/(16 (25 + 1))
= 9615
Error
= (Calculated Baud Rate – Desired Baud Rate)
Desired Baud Rate
= (9615 – 9600)/9600
= 0.16%
Note 1: Based on FCY = FOSC/2, Doze mode and PLL are disabled.
DS39937B-page 134
Preliminary
© 2009 Microchip Technology Inc.