PIC16C745/765
Writing a new value to the SPBRG register causes the
BRG timer to be reset (or cleared). This ensures the
BRG does not wait for a timer overflow before output-
ting the new baud rate.
11.1
USART Baud Rate Generator (BRG)
The BRG supports both the asynchronous and syn-
chronous modes of the USART. It is a dedicated 8-bit
baud rate generator. The SPBRG register controls the
period of a free running 8-bit timer. In asynchronous
mode, bit BRGH (TXSTA<2>) also controls the baud
rate. In synchronous mode, bit BRGH is ignored.
Table 11-1 shows the formula for computation of the
baud rate for different USART modes which only apply
in master mode (internal clock).
11.1.1 SAMPLING
The data on the RC7/RX/DT pin is sampled three times
near the center of each bit time by a majority detect cir-
cuit to determine if a high or a low level is present at the
RX pin.
Given the desired baud rate and FINT, the nearest inte-
ger value for the SPBRG register can be calculated
using the formula in Table 11-1. From this, the error in
baud rate can be determined.
It may be advantageous to use the high baud rate
(BRGH = 1) even for slower baud clocks. This is
because the FINT/(16(X + 1)) equation can reduce the
baud rate error in some cases.
TABLE 11-1: BAUD RATE FORMULA
SYNC
BRGH = 0 (Low Speed)
BRGH = 1 (High Speed)
0
1
(Asynchronous) Baud Rate = FINT/(64(SPBRG+1))
(Synchronous) Baud Rate = FINT/(4(SPBRG+1))
Baud Rate= FINT/(16(SPBRG+1))
NA
TABLE 11-2: BAUD RATES FOR SYNCHRONOUS MODE
4 MHz
6 MHz
24 MHz
Desired
Baud
Actual
Baud
% of
Error
Actual
Baud
% of
Error
Actual
Baud
% of
Error
SPBRG
SPBRG
SPBRG
300
1200
2400
4800
4807.69
9615.38
0.16
207
9600
0.16
0.16
0.16
2.12
8.51
8.51
8.51
103
51
25
16
7
9615.38
19230.77
38461.54
57692.31
115384.62
250000.00
500000.00
0.16
155
19200
38400
57600
19230.77
38461.54
58823.53
0.16
0.16
0.16
0.16
8.51
8.51
77
38
25
12
5
38461.54
57692.31
0.16
155
0.16
0.16
0.16
0.16
8.51
103
51
25
12
5
115200 125000.00
230400 250000.00
460800 500000.00
921600
115384.62
230769.23
461538.46
1000000.00
3
1
2
1999 Microchip Technology Inc.
Advanced Information
DS41124A-page 77