Datasheet

PIC18F87J50 FAMILY
DS39775C-page 284 © 2009 Microchip Technology Inc.
EXAMPLE 20-1: CALCULATING BAUD RATE ERROR
TABLE 20-2: REGISTERS ASSOCIATED WITH BAUD RATE GENERATOR
For a device with Fosc of 16 MHz, desired baud rate of 9600, Asynchronous mode, and 8-bit BRG:
Desired Baud Rate = F
OSC/(64 ([SPBRGHx:SPBRGx] + 1))
Solving for SPBRGHx:SPBRGx:
X=((FOSC/Desired Baud Rate)/64) – 1
= ((16000000/9600)/64) – 1
= [25.042] = 25
Calculated Baud Rate = 16000000/(64 (25 + 1))
= 9615
Error = (Calculated Baud Rate – Desired Baud Rate)/Desired Baud Rate
= (9615 – 9600)/9600 = 0.16%
Name Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0
Reset Values
on Page:
TXSTAx
CSRC TX9 TXEN SYNC SENDB BRGH TRMT TX9D 63
RCSTAx SPEN
RX9 SREN CREN ADDEN FERR OERR RX9D 63
BAUDCONx ABDOVF RCIDL DTRXP SCKP BRG16 WUE ABDEN 65
SPBRGHx EUSARTx Baud Rate Generator Register High Byte 65
SPBRGx EUSARTx Baud Rate Generator Register Low Byte 65
Legend: — = unimplemented, read as ‘0. Shaded cells are not used by the BRG.