LCD 4x20 on a LPC1768

Hello everyone,
I'd like to interface a 4x20 character LCD. But I can not do it!
Finally I arrive boot (the black line disappears) but I do not see the cursor blinking and the characters that I want to write.
So I just see whether you already have an interface with LPC1768 and if you do not have a library to share?

So that's not where I am:

Lcd library

void init_LCD(void) {

         LCD_Light (1)
         LCD_EN(0)
         os_dly_wait (100);
         command (0x30);
         os_dly_wait (40);
         command (0x30);
         os_dly_wait (40);
         command (0x30);
         os_dly_wait (40);
         command (0x38);
         os_dly_wait (40);
         command (0x0F);
         os_dly_wait (40);
         command (0x01);
         os_dly_wait (40);
         command (0x06);
         os_dly_wait (40);


}

void command (char data) {

        LPC_GPIO0->FIOPIN |= (data<<15);       /* place data */
        LCD_RS(0)
        LCD_RW(0)
        LCD_EN(1)
        os_dly_wait (2);
        LCD_EN(0)

}

void write (char data) {

        LPC_GPIO0->FIOPIN |= (data<<15);       /* place data */
        LCD_RS(1)
        LCD_RW(0)
        LCD_EN(1)
        os_dly_wait (2);
        LCD_EN(0)


}

void write_char(char data) {

        command (0x38);
        os_dly_wait (40);
        command (0x0c);
        os_dly_wait (40);
        command (0x06);
        os_dly_wait (40);
        write (data);
        os_dly_wait (40);

}

main code

__task void LCD (void) {


init_LCD(); write_char (0x30); for (;;) {}
}

Best regard

Bernard

Parents
  • with no knowledge of the LPC1768 (have, so far, only worked with ST)
    under the assumption that you are using a traditional character LCD.

    LPC_GPIO0->FIOPIN |= (data<<15); /* place data */

    1) does GPIO0 have >23 pins?
    2) or'ing tha data without first and'ing to clear the field is not a good idea

    Erik

Reply
  • with no knowledge of the LPC1768 (have, so far, only worked with ST)
    under the assumption that you are using a traditional character LCD.

    LPC_GPIO0->FIOPIN |= (data<<15); /* place data */

    1) does GPIO0 have >23 pins?
    2) or'ing tha data without first and'ing to clear the field is not a good idea

    Erik

Children
More questions in this forum