To calculate BT0 and BT1 from a fixed baud rate, user need to define the value of Tseg1 and Tseg2 by himself, or use the standard value. The formula is:
Baud rate = 1/(1*TSCL+Tseg1+Tseg2)
where TSCL = 2TCLK*(lower 6 bits of BT0 + 1)
Tseg1 = TSCL*(lower 4 bits of BT1 +1)
Tseg2 = TSCL*(bit 4 to bit 6 of BT1 +1)
TCLK = 1/16000000
For example, to get 10Kbps baud rate, we have:
1/Baud rate = TSCL*(1+Tseg1/TSCL+Tseg2/TSCL)
(1+Tseg1/TSCL+Tseg2/TSCL) = 16000000/10000/(2*(lower 6 bits of BT0 + 1))
(1+Tseg1/TSCL+Tseg2/TSCL) = 800/(lower 6 bits of BT0 + 1)
The possible value of BT0 is from 0 to 63, but the value of (1+Tseg1/TSCL+Tseg2/TSCL) must be an integer. So Let BT0 = 1Fh = 31
(1+Tseg1/TSCL+Tseg2/TSCL) = 25
Possible value of Tseg1/TSCL is 1 to 16 and possible value of Tseg2/TSCL is 1 to 8. Let Tseg1/TSCL = 16 and Tseg2/TSCL = 8 to meet the value 25, then BT1 = 7Fh = 127
Thank you for your feedback
We will look over your massage and get back to you soon if you need further assistance!