English
Language : 

PIC32MX440F256H-80I Datasheet, PDF (436/646 Pages) Microchip Technology – 64/100-Pin General Purpose and USB 32-Bit Flash Microcontrollers
PIC32MX3XX/4XX
19.2 UART Baud Rate Generator (BRG)
The UART module includes a dedicated 16-bit Baud
Rate Generator. The BRGx register controls the period
of a free-running 16-bit timer. Equation 19-1 shows the
formula for computation of the baud rate with
BRGH = 0.
EQUATION 19-1: UART BAUD RATE WITH
BRGH = 0(1)
Baud Rate =
FPB
16 • (UxBRG + 1)
UxBRG =
FPB
16 • Baud Rate
–1
Note 1: FPB denotes the peripheral bus clock
frequency.
Example 19-1 shows the calculation of the baud rate
error for the following conditions:
• FPB = 4 MHz
• Desired Baud Rate = 9600
The maximum possible baud rate with BRGH = 0 is
FPB/16.
The minimum possible baud rate is FPB/(16 * 65536).
Equation 19-2 shows the formula for computation of
the baud rate with BRGH = 1.
EQUATION 19-2: UART BAUD RATE WITH
BRGH = 1(1)
Baud Rate =
FPB
4 • (UxBRG + 1)
UxBRG =
FPB
4 • Baud Rate
–1
Note 1: FPB denotes the instruction cycle clock
frequency.
The maximum possible baud rate with BRGH = 1 is
FPB/4 for UxBRG = 0, and the minimum possible baud
rate is FPB/(4 * 65536).
Writing a new value to the UxBRG register causes the
baud rate counter to be cleared. This ensures that the
BRG does not wait for a timer overflow before it
generates the new baud rate.
EXAMPLE 19-1: BAUD RATE ERROR CALCULATION (BRGH = 0)
Desired Baud Rate
= Fpb/(16 (UxBRG + 1))
Solving for UxBRG value:
UxBRG
= ( (Fpb/Desired Baud Rate)/16) – 1
UxBRG
= ((4000000/9600)/16) – 1
UxBRG
= [25.042] = 25
Calculated Baud Rate = 4000000/(16 (25 + 1))
= 9615
Error
= (Calculated Baud Rate – Desired Baud Rate)
Desired Baud Rate
= (9615 – 9600)/9600
= 0.16%
DS61143E-page 434
Preliminary
© 2008 Microchip Technology Inc.