According to the 8051 text book, in order to generate a standard baudrate used for serial rs232 coomunication, the XTAL frequency has to be 11.059MHZ. My current project uses a 14.318MHZ XTAL. Is there anyway I can get around this in order to generate a standard baudrate such as 9600 etc .... Thanks in advance Jimmy
Keil has a nice baud rate calculator at http://www.keil.com/c51/baudrate.asp. It shows you can achieve 9600bps with about 2.9% error using timer 1. If you are using a 8052 derivative, the text book (datasheet) shows how to use timer 2 as the baud rate generator. Timer 2 will get you closer to standard baud rates using oddball XTAL frequencies -- 9600bps with about 0.9% error in your case.
The link above does not exist. PLease check and re-post. Jimmy
http://www.keil.com/c51/baudrate.asp
Somehow, the original link includes a spurious '.' on the end!
I usually use 14.7456MHz. This frequency will allow you to set the baudrates without any error and it is still poretty close to the maximum clockrate of the standard c51 (16MHz). Take care Sven
Mine is a 18.432Mhz. it's working fine
Well, if you have a c51 derivate that can be clocked that high... other than that, it is always a risk of opverclocking an MCU. I wouldn't do that in a serious project.
"Well, if you have a c51 derivate that can be clocked that high... " Most new "advanced" derivatives will run at much more than 16Mhz. e.g. the Philips P89C51Rx2 will run at 20/6 or 33/12 Mhz. In the 6 clock mode, the prescaler is twice as long so you will have to calculate the baudrate with 40Mhz if you use a 20 Mhz crystal. Ha' en rar dag Erik
Yes, i know, I used to give an example of quartz who permit a good baudrate.