I have 4 Mhz crystal easy8051 development board. And i have a simple code about serial com example written in keil above.With the TH!=0xfe value baud rate=5208 but i want the baudrate=9600.How can i do that?
void delay(int wait) { int i; for(i=0;i<=sure;i++) {;} } void main(void) { SCON=0x50; TMOD=0x20; TH1=0xfe; TR1=1; TI=1; printf("hello"); delay(100); while(1); }
but i want the baudrate=9600.How can i do that?
I'm working entirely from memory, but I think you can't. You need to either use a different crystal or a different micro with a more flexible clock subsystem than the standard 8051.
I agree with Hans
With 4Mhz crystal you can not, you'd better use 11.0592Mhz for exactly 9600baud.
http://www.keil.com/c51/baudrate.asp
wait...
please upload details into mihd.net