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
But tomorow I will place an Pull-up resistor on the LCD to pull the level on 5V. just to adapt the pin level.
But you think the LCD would work with 3.3V?
The LCD, if specified with Vih(min) at 2V7, will work just fine with a 3V3 port, however still must be powered by 5V.
You MUST configure the outputs as push-pull or you will have severe risetime problems (check with a scope). I have, forgot the brand, had problems with a LCD that was extremely "risetime sensitive".
When you configure as push-pull DO NOT install the resistors.
If you install the resistors and it start working all you have done is proving that your pins are not configured as push-pull
Erik
I/O in push-pull? I suppose but i don't really know
STOP, dig out the datsheet (or the NXP base software description) and find out about port configuration.
You can damage the uC and/or the LCD with misconfigured ports.