serial communication in mikro c with pic16f877a

Status
Not open for further replies.

aameer

Full Member level 4
Joined
May 12, 2010
Messages
216
Helped
33
Reputation
64
Reaction score
32
Trophy points
1,308
Location
Bangalore
Activity points
2,503
Hello friends
i am trying to communicate a character from PC to micro controller(Pic16f877a)
But i am able to send from micro controller to PC but able to receive and display on LCD .
Please help me.Its Urgent...
I checked Max 232 and cable .they are absolutely fine.

Code:
void main()
{
unsigned short i;
TRISB = 0; // PORTB is output
Lcd_Init(&PORTB); // Initialize LCD connected to PORTB
Lcd_Cmd(Lcd_CLEAR); // Clear display
Lcd_Cmd(Lcd_CURSOR_OFF); // Turn cursor off
Lcd_Out(1, 1, "HI"); // Print text to LCD, 2nd row, 1st column
Usart_Init(9600);
Delay_ms(100);
Usart_Write('p');
Delay_ms(100);
do
{
if (Usart_Data_Ready()) // If data is received
{
i = Usart_Read(); // Read the received data
Usart_Write(i); // Send data via USART
Lcd_Chr(2,1,i+48);
}
} while (1);


}



with Regards
Aameer

- - - Updated - - -

Guys suggest me what is the problem.. Its urgent
 
Last edited by a moderator:

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…