Hi,
I need to program an old 8051 board with an AT89C51CC03. I like to write my own interrupt driven serial port (UART) function without using some library function like printf() or putchar().
I get timer1 running and generating interrupts. I get the uart running and generating interrupts. But...
...one thing I don't understand: - on the one hand timer1 can be programmed somehow as a baudrate generator for the serial port? (how?) - on the other hand, the uart has it's own FUart Clock signal derived directly from XTal
I do not see where the connection lays between timer1 as a baudrate generator and the uart transceiver speed...
I searched through the uC datasheet many times and read many Internet articles but still did not found the answer.
Hope someone can help me out.
I do not see where the connection lays between timer1 as a baudrate generator and the uart transceiver speed.. without wading through the datasheet i will surmise that the T1 'feature' is there only for compatibility reasons
If I change the Timer1 preload value so Timer1 needs only 40 steps in stead of 80 to reload then the UART baudrate is doubled.
So Timer1 does somehow directly drive the UART clock speed.
As for now I think I found the solution after many experiments.
The Timer1 overflow behaviour exactly matches the uC datasheet description.
The UART baudrate depends both on the Timer1 reload value as wel as on the FUart Clock frequency.
My findings are these:
The Timer1 overflow frequency is divided by a factor of 32 and then transported to the FUart Clock divider input. The FUsart Clock divider output goes straight to the UART clock input.
So the FUsart Clock divider input is NOT directly connected to XTAL as figure 9 page 19 of the datasheet.pdf suggests...
Thanks for listening anyway ;-)