| ??? 01/17/03 21:44 Read: times |
#36678 - RE: 87LPC764 and LCD display help |
Adam
This is the code that I use to check the LCD On some LCD's you have to pulse the clock to get the busy signal,so this code will work on most HD44780 and clones.Note that is uses 4 bit mode through port 0 with pullups. do { // wait until lcd is ready lcd_port =0xf0;//set upper nibble to input lcd_rw = 1; lcd_enable = 1; // toggle data clock delay_us(); lcd_val = lcd_port; // read data bus lcd_enable = 0; delay_us(); lcd_enable = 1; lcd_short_delay(); lcd_enable = 0; } while(lcd_val & 0x80);//keep looping if DB7 set,clears when not busy the initialisation code is void init_lcd(void) { U8 i; lcd_port=0; lcd_long_delay(); for(i=1;i<=3;++i) { lcd_port=0x30; delay_ms(10); lcd_enable = 1; lcd_short_delay(); lcd_enable = 0; } lcd_port=0x20; lcd_long_delay(); lcd_enable = 1; lcd_short_delay(); lcd_enable = 0; lcd_long_delay(); lcd_send_byte(1,0x28); lcd_long_delay(); lcd_send_byte(1,0x08); lcd_long_delay(); lcd_send_byte(1,0x0c); lcd_long_delay(); lcd_send_byte(1,0x06); } |



