This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Send Serial

hi

i want to send a serial data using 89C2051, i got a code from net but its not working

i checked it on Proteus 7 Professional.

how can i send any data or Receive it?

#include "reg51.h"
#include "stdio.h"
unsigned char a=0;
void serial_send();

void main ()
{
       TMOD = 0x20;
       SCON = 0x50;
       TH1  = 0xFD;
       TL1  = 0xFD;
       TR1  = 1;
       P1 = 255;
       a = 255;
while(1)
{
        if (P1 != a)
        {
        a = P1;
        serial_send();
        }
}
}
void serial_send()
{
        while(!TI);
        {
        TI = 0;
        SBUF = a;
        }
}