Sending Data to Lcd using UART

Thread Starter

noq23

Joined Jun 24, 2010
5
Hi, guys. I have problems regarding sending data to LCD through RS232. But I don't know whether my code is correct. I can't make it work with my code. I'm using a mikroC compiler. When I run it, the lcd did not successfully recevied the data.

My program:

char *i = "NNNNN" ;


void main() {

TRISB = 0x00;
Lcd_Init(&PORTB);
Lcd_Cmd(Lcd_CLEAR);
Lcd_Cmd(Lcd_CURSOR_OFF);

// Initialize USART module (8 bit, 2400 baud rate, no parity bit..)
Usart_Init(2400);

while(1) {
if (Usart_Data_Ready()) { // If data is received
i = Usart_Read(); // Read the received data
Usart_Write(i); // Send data via USART
Lcd_Out(1,1, i);


}
}
}//~!

somebody please help me..
 

retched

Joined Dec 5, 2009
5,207
What data are you sending to the LCD?

Have you tried using a test or example program to ensure your wiring is right and your LCD is working properly?

Also, it looks like you are trying to read from the uart as 'i' then trying to send it out.

Instead of using variables, just try to send:
Lcd_Out(1,1,"Hello");
That way you can see if it is your variable problem or not.

CHECK YOUR WIRING! ;)
 
Top