| Home Pic in Greek Οδηγός χρήσης Pic SFR explanation for PIC16F873(17) |
SFR explanation for PIC16F873(17) ( Signaling speed by SPBRG register )
On this page, the setting of signaling speed of the USART is described. At the manual of PIC16F873, Baud is used as the signaling speed. It should make a bps. Strictly, "baud" and "bps" are different. In the following table, "bps" is used. In case of PIC, the signaling speed changes with the clock frequency of PIC. The setting of a signaling speed is done with the SPBRG register. In case of the asynchronous mode, the speed error with the communication device outside occurs. The selection of the clock where few errors occur is needed. The calculation formula with SPBRG register value and signaling speed refer to "The signaling speed designating". Asynchronous communication speed in low-speed ( BRGH = 0 )
Signaling speed outside K-bps | Fosc=4MHz | Fosc=10MHz | Fosc=20MHz
Signaling speed (K-bps) | Error (%) | SPBRG (Decimal) | Signaling speed (K-bps) | Error (%) | SPBRG (Decimal) | Signaling speed (K-bps) | Error (%) | SPBRG (Decimal)
0.3 | 0.300 | 0 | 207 | - | - | - | - | - | -
1.2 | 1.202 | 0.17 | 51 | 1.202 | 0.17 | 129 | 1.221 | 1.75 | 255
2.4 | 2.404 | 0.17 | 25 | 2.404 | 0.17 | 64 | 2.404 | 0.17 | 129
9.6 | 8.929 | 6.99 | 6 | 9.766 | 1.73 | 15 | 9.766 | 1.73 | 31
19.2 | 20.833 | 8.51 | 2 | 19.531 | 1.72 | 7 | 19.531 | 1.72 | 15
28.8 | 31.250 | 8.51 | 1 | 31.250 | 8.51 | 4 | 31.250 | 8.51 | 9
33.6 | - | - | - | 31.250 | 6.99 | 4 | 34.722 | 3.34 | 8
57.6 | 62.500 | 8.51 | 0 | 52.083 | 9.58 | 2 | 62.500 | 8.51 | 4
HIGH | 0.244 | - | 255 | 0.610 | - | 255 | 1.221 | - | 255
LOW | 62.500 | - | 0 | 158.250 | - | 0 | 312.500 | - | 0
Asynchronous communication speed in high-speed ( BRGH = 1 )
Signaling speed outside K-bps | Fosc=4MHz | Fosc=10MHz | Fosc=20MHz
Signaling speed (K-bps) | Error (%) | SPBRG (Decimal) | Signaling speed (K-bps) | Error (%) | SPBRG (Decimal) | Signaling speed (K-bps) | Error (%) | SPBRG (Decimal)
0.3 | - | - | - | - | - | - | - | - | -
1.2 | 1.202 | 0.17 | 207 | - | - | - | - | - | -
2.4 | 2.404 | 0.17 | 103 | 2.441 | 1.71 | 255 | - | - | -
9.6 | 9.615 | 0.16 | 25 | 9.615 | 0.16 | 64 | 9.615 | 0.16 | 129
19.2 | 19.231 | 0.16 | 12 | 19.531 | 1.72 | 31 | 19.231 | 0.16 | 64
28.8 | 27.798 | 3.55 | 8 | 28.409 | 1.36 | 21 | 29.070 | 0.94 | 42
33.6 | 35.714 | 6.29 | 6 | 32.895 | 2.10 | 18 | 33.784 | 0.55 | 36
57.6 | 62.500 | 8.51 | 3 | 56.818 | 1.36 | 10 | 59.524 | 3.34 | 20
HIGH | 0.977 | - | 255 | 2.441 | - | 255 | 4.883 | - | 255
LOW | 250.000 | - | 0 | 625.000 | - | 0 | 1250.000 | - | 0
Synchronous communication speed In case of synchronous mode, the error with signaling speed doesn't occur. To decide the value of SPBRG register, I calculated the value same as asynchronous mode.
Signaling speed outside K-bps | Fosc=4MHz | Fosc=10MHz | Fosc=20MHz
Signaling speed (K-bps) | Error (%) | SPBRG (Decimal) | Signaling speed (K-bps) | Error (%) | SPBRG (Decimal) | Signaling speed (K-bps) | Error (%) | SPBRG (Decimal)
0.3 | - | - | - | - | - | - | - | - | -
1.2 | - | - | - | - | - | - | - | - | -
2.4 | - | - | - | - | - | - | - | - | -
9.6 | 9.615 | 0.16 | 103 | - | - | - | - | - | -
19.2 | 19.231 | 0.16 | 51 | 19.231 | 0.16 | 129 | - | - | -
28.8 | 28.571 | 0.79 | 34 | 29.070 | 0.94 | 85 | 28.902 | 0.35 | 172
33.6 | 33.333 | 0.79 | 29 | 33.784 | 0.55 | 73 | 33.557 | 0.13 | 148
57.6 | 58.824 | 2.12 | 16 | 58.140 | 0.94 | 42 | 57.471 | 0.22 | 86
Difference of "Baud" and "bps" "Baud" is the unit which shows the signal which changes into 1 second. "bps" is the unit which shows the number of the bits to transfer into 1 second. When send the data which make the positive voltage of the circuit as "1", make the negative voltage as "0", "baud" and "bps" become the same value. It often uses a telephone line to connect the Internet. A telephone line is made to conduct voice and is designed to let through the frequency from 300 Hz to 3400 Hz. 3400Hz is the signal which changes into 1 second 3400 times. So, it is possible to let through maximum of 3400-bps data. Actually, it isn't possible to let through 3400 bps. The recent modem can do high-speed communication like 28.8Kbps, 33.6Kbps, 56Kbps and so on. These modems are using a phase modulation and more than one bit can be transferred in the signal change in the once. In case of the modem of 28.8Kbps, the 9-bit signal can be transferred in the signal change in the once. So, it becomes 28800/9 = 3200 baud when showing in baud. The signal to have let out from the personal computer at 28800 bps becomes a 3200-baud signal with the modem and it reaches the other party modem which connects through the telephone line. The other party modem extracts a 28800-bps signal from the 3200-baud signal and transfers it to the personal computer.