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; } }
i got a code from net but its not working I lost count how many times I have seen that one.
as I have often stated: ""sample code" can be a time saver if you could code it yourself, if you could NOT code it yourself, you will be totally lost because of the errors in the "sample code", let alone grasping the functionality".
Erik
A 'program' like the above is totally worthless, it does not specify processor ('51 will NOT do) and clock. Let alone publishing uncommented 'code'
Erk