hii,
I have been trying in vain to transmit and receive a string in 8051. First character gets displayed on the lcd, but the rest do not. I shorted RXD and TXD pins. The code in c is as follows:
void main() { unsigned char char_to_write[] = "hello, this is the data"; RECEIVED = 0; init_timer(); init_lcd(); initialize_serial(); pass_cmd(0x80); display_routine(char_to_write); while(1); }
void display_routine(unsigned char *this_is) { while(*this_is) { SBUF = *this_is++; TI = 1; while(!RECEIVED); RECEIVED = 0; } }
void init_timer() \\for 4800 baud rate { TICK = 0; EA = 1; ET0 = 1; TMOD = 1; TH0 = 0XFC; TL0 = 0X18; }
void initialize_serial() { SCON = 0X50; TMOD = 0X20; TH1 = 0XF3; TR1 = 1; EA = 1; ES = 1; }
void serialint() interrupt 4 { if(TI) TI = 0; if(RI) { pass_data((unsigned char)SBUF); // displays SBUF value on lcd. RI = 0; RECEIVED = 1; } }
I dont find any problem with lcd display function or timer function. Any help will be appreciated. Thanx, digitalBug