0
17kviews
Write 89C51 C program to transfer YES serially at baud rate 9600 continuously Use 8 bit data and 1 stop bit. Assume crystal frequency 11.0592 MHz.
1 Answer
1
2.4kviews

enter image description here

enter image description here

0
608views

$ Clock = \frac{11.0592\times10^6}{12} = 921.6KHz$ $ UART= \frac{921.6\times10^3}{32} = 28800Hz$ For Baud rate of 9600: $ n= \frac{28800}{9600}=3=(-3)=FDH$ **Program:** #include $<reg51.h>$ void SerTx(unsigned char); void main (void) { TMOD=0x20; $ \ \ \ \ \ \ \ \ \ \ $// use Times1, mode 2 TH1= 0xFD; $ \ \ \ \ \ \ \ \ \ \ $\\ 9600 baud rate SCON=0x50; $ \ \ \ \ \ \ \ \ \ \ $//01010000 Serial mode 1 TR1=1; // Start timer while (1) { SerTx('Y'); SerTx('E'); SerTx('S'); } $ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $// End of While } void SerTx(unsigned char x); { SBUF=x; $ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $// place value in buffer while (TI==0); $ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $// wait until transmitted Ti=0; $ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $// Clear TI Flag

}

Please log in to add an answer.