By: Masud-ul-Hasan
19
Using Timer 1 as Baud Rate Clock
•Usually the timer is used in auto-reload mode and TH1 is loaded with a proper reload value.
•Formula for the baud rate in modes 1 and 3 is
•Baud Rate = Timer 1 Overflow Rate / 32
•e.g., For 1200 baud
•1200 = Timer 1 Overflow Rate / 32
•Timer 1 Overflow Rate = 38400 Hz
•Timer must overflow at a rate of 38.4 kHz and the timer is clocked at a rate of 1000 kHz (1 MHz), overflow required every 1000/38.4 = 26.04 clocks, so
•MOV TH1, # -26
•Due to rounding, there is a slight error in the resulting baud rate. Up to 5% is tolerable using asynchronous communications. Exact baud rates are possible using an 11.059 MHz crystal (Table 5-3).
•