PIC24FV16KM204 FAMILY
DS33030A-page 174
Advance Information
2013 Microchip Technology Inc.
15.1
UARTx Baud Rate Generator
(BRG)
The UARTx module includes a dedicated 16-bit Baud
Rate Generator (BRG). The UxBRG register controls
the period of a free-running, 16-bit timer.
provides the formula for computation of the baud rate
with BRGH =
0
.
EQUATION 15-1:
UARTx BAUD RATE WITH
BRGH =
0
(
)
provides the calculation of the baud rate
error for the following conditions:
• F
CY
= 4 MHz
• Desired Baud Rate = 9600
The maximum baud rate (BRGH =
0
) possible is
F
CY
/16 (for UxBRG =
0
) and the minimum baud rate
possible is F
CY
/(16 * 65536).
shows the formula for computation of
the baud rate with BRGH =
1
.
EQUATION 15-2:
UARTx BAUD RATE WITH
BRGH =
1
(
)
The maximum baud rate (BRGH =
1
) possible is F
CY
/4
(for UxBRG =
0
) and the minimum baud rate possible
is F
CY
/(4 * 65536).
Writing a new value to the UxBRG 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 15-1:
BAUD RATE ERROR CALCULATION (BRGH =
0
)
(
Note 1:
Based on F
CY
= F
OSC
/2; Doze mode
and PLL are disabled.
Baud Rate =
F
CY
16 • (UxBRG + 1)
F
CY
16 • Baud Rate
UxBRG =
–
1
Baud Rate =
F
CY
4 • (UxBRG + 1)
F
CY
4 • Baud Rate
UxBRG
=
–
1
Note 1:
Based on F
CY
= F
OSC
/2; Doze mode
and PLL are disabled.
Desired Baud Rate
= F
CY
/(16 (UxBRG + 1))
Solving for UxBRG value:
UxBRG
= ((F
CY
/Desired Baud Rate)/16)
–
1
UxBRG
= ((4000000/9600)/16)
–
1
UxBRG
= 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 F
CY
= F
OSC
/2; Doze mode and PLL are disabled.
Summary of Contents for PIC24FV16KM204 FAMILY
Page 312: ...PIC24FV16KM204 FAMILY DS33030A page 312 Advance Information 2013 Microchip Technology Inc ...
Page 313: ... 2013 Microchip Technology Inc Advance Information DS33030A page 313 PIC24FV16KM204 FAMILY ...
Page 315: ... 2013 Microchip Technology Inc Advance Information DS33030A page 315 PIC24FV16KM204 FAMILY ...
Page 316: ...PIC24FV16KM204 FAMILY DS33030A page 316 Advance Information 2013 Microchip Technology Inc ...
Page 317: ... 2013 Microchip Technology Inc Advance Information DS33030A page 317 PIC24FV16KM204 FAMILY ...
Page 322: ...PIC24FV16KM204 FAMILY DS33030A page 322 Advance Information 2013 Microchip Technology Inc ...