|00|01|02|03|04|05|06|07|40|41|42|43|44|45|46|47|
//----------------------------
void lcd_init(void)
{
int8 i;
output_high(LCD_POWER); // *** Add this line
delay_ms(40); // *** Add this line
output_low(LCD_RS);
#ifdef USE_LCD_RW
output_low(LCD_RW);
#endif
output_low(LCD_E);
//-----------------------
// *** Comment out this section. ***
/*
delay_ms(15);
for(i=0 ;i < 3; i++)
{
lcd_send_nibble(0x03);
delay_ms(5);
}
*/
//------------------------
lcd_send_nibble(0x02);
for(i=0; i < sizeof(LCD_INIT_STRING); i++)
{
lcd_send_byte(0, LCD_INIT_STRING[i]);
// If the R/W signal is not used, then
// the busy bit can't be polled. One of
// the init commands takes longer than
// the hard-coded delay of 60 us, so in
// that case, lets just do a 5 ms delay
// after all four of them.
#ifndef USE_LCD_RW
delay_ms(5);
#endif
}
} #define LCD_POWER PIN_D7 //#ifdef USE_LCD_RW
//while(bit_test(lcd_read_byte(),7)) ;
//#else
delay_us(100);
//#endif
Return to PIC® MCU General Discussion
Users browsing this forum: No registered users and 1 guest