Baud Rate Generator
Use timer 1 overflow to generate serial data clock
- serial clock is 16x oversampled, i.e. baud rate x16
- SMOD bit (PCON register)
- 0: divides baud rate by 2
Typical timer 1 setup
- auto-reload timer
- reload value determines overflow clock rate
Baud rate calculation
- Clocks between overflows = 12 x (256-TH1) clocks
- Overflow frequency = Fclk/Clocks-between-overflows
- Baud rate (assuming SMOD = 1)
- 1/16 x overflow-frequency
- Baud rate = 24MHz / (16 x 12 x (256-TH1))
- Max Baud rate = 125KHz
- TH1 value for 9600 baud = 13