Sending Data to Lcd using UART

Discussion in 'Programmer's Corner' started by noq23, Jun 30, 2010.

  1. noq23

    Thread Starter New Member

    Jun 24, 2010
    5
    0
    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..[​IMG]
     
  2. retched

    AAC Fanatic!

    Dec 5, 2009
    5,201
    312
    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! ;)
     
Loading...