Does the xlcd.h, or its source code have problem? I can not make the following code work. The following code is changed from MPLAB-C18-Libraries.pdf, 3.2.2 example (page 69). I wired LCD as xlcd.h default configuration. -------------- RW_PIN PORTBbits.RB6 /* PORT for RW */ RS_PIN PORTBbits.RB5 /* PORT for RS */ E_PIN PORTBbits.RB4 /* PORT for E */ USE low nibble PB0-PB3 for D0-D3 in LM579LT 20x2 (44780) LCD. ----------------- #include <p18f252.h> #include <xlcd.h> #include <delays.h> void DelayFor18TCY( void ) { Nop(); Nop(); Nop(); Nop(); Nop(); Nop(); Nop(); Nop(); Nop(); Nop(); Nop(); Nop(); } void DelayPORXLCD( void ) { Delay1KTCYx(60); //Delay of 15ms return; } void DelayXLCD( void ) { Delay1KTCYx(20); //Delay of 5ms return; } void main( void ) { char data='H'; OpenXLCD( FOUR_BIT & LINE_5X10 ); while (1); } |
|
Anyone used Microchip C18 to control 44780 LCD?
Started by ●July 16, 2003
Reply by ●July 19, 20032003-07-19
Did anyone look at the xlcd.h and its source code? --- In , yimab <no_reply@y...> wrote: > Does the xlcd.h, or its source code have problem? I can not make the > following code work. > > The following code is changed from MPLAB-C18-Libraries.pdf, 3.2.2 > example (page 69). > I wired LCD as xlcd.h default configuration. > -------------- > RW_PIN PORTBbits.RB6 /* PORT for RW */ > RS_PIN PORTBbits.RB5 /* PORT for RS */ > E_PIN PORTBbits.RB4 /* PORT for E */ > > USE low nibble PB0-PB3 for D0-D3 in LM579LT 20x2 (44780) LCD. > ----------------- > > #include <p18f252.h> > #include <xlcd.h> > #include <delays.h> > void DelayFor18TCY( void ) > { > Nop(); > Nop(); > Nop(); > Nop(); > Nop(); > Nop(); > Nop(); > Nop(); > Nop(); > Nop(); > Nop(); > Nop(); > } > void DelayPORXLCD( void ) > { > Delay1KTCYx(60); //Delay of 15ms > return; > } > void DelayXLCD( void ) > { > Delay1KTCYx(20); //Delay of 5ms > return; > } > void main( void ) > { > char data='H'; > OpenXLCD( FOUR_BIT & LINE_5X10 ); > while (1); > } |