0
4.4kviews
Write C language program to transfer the message MSBTE serially at 9600 baud rate, 8 bit data and 1 stop bit.
1 Answer
1
480views

The program

#include <reg51.h>
void main(void)  
{  
    unsigned char text[ ] = “MSBTE”; //initialize array  
    TMOD = 0x20;                    //Initialize timer 1 in mode 2  
    TH1 = 0xFD;                     //baud rate 9600  
    SCON = 0x50;                    //start serial communication ( 8bit , 1 stop bit , REN )  
    TR1 = 1;                        //start timer 1  

    for(i=0;i<6;i++)                //Read array and transmit serially till end  
    {
        SBUF = text[i];  
        while(TI==0);               //check interrupt  
        TI = 0;                     //clear interrupt  
    }  
}
Please log in to add an answer.