Hi,
I have been trying to get a standard 44780 LCD to work but all I get is Lines 1 & 3 lit up with solid blocks, and nothing on Lines 2 & 4. See Photo.
The PIC is a16F886 and the set-up is all correctly wired and has been proven to work using a HEX file given to me by a friend who programs in ASM. Unfortunately he knows nothing about PicBasic...
The Code I've tried is;
The PIC is working OK (LED lights-up)Code:'******************************************************************************* '* 20 x 4 LCD for Display * '* * '* LCD connected as follows: * '* LCD PIC PWR * '* 01 Vss Ground * '* 02 Vdd 5 volts * '* 03 Vo Ground (contrast) * '* 04 RS 24 PortB.3 * '* 05 RW Ground * '* 06 E 23 PortB.2 * '* 07 DB0 No connect * '* 08 DB1 No connect * '* 09 DB2 No connect * '* 10 DB3 No connect * '* 11 DB4 25 PortB.4 * '* 12 DB5 26 PortB.5 * '* 13 DB6 27 PortB.6 * '* 14 DB7 28 PortB.7 * '* 15 A 5 volts (backlight) * '* 16 K Ground (backlight) * '* * '******************************************************************************* ' Defines '******************************************************************************* DEFINE OSC 4 'using a 4 MHz oscillator DEFINE LCD_DREG PORTB 'LCD data port DEFINE LCD_DBIT 4 'LCD data starting bit 0 or 4 DEFINE LCD_RSREG PORTB 'LCD register select port DEFINE LCD_RSBIT 3 'LCD register select bit DEFINE LCD_EREG PORTB 'LCD enable port DEFINE LCD_EBIT 2 'LCD enable bit DEFINE LCD_RWREG PORTB 'LCD read/write port (Not Used This Time) DEFINE LCD_RWBIT 1 'LCD read/write bit (Not Used This Time) DEFINE LCD_BITS 4 'LCD bus size 4 or 8 DEFINE LCD_LINES 4 'Number lines on LCD DEFINE LCD_COMMANDUS 1500 'Command delay time in us DEFINE LCD_DATAUS 44 'Data delay time in us ' Main Program '******************************************************************************* PAUSE 500 ' Wait .5 second for PIC and LCD to boot ADCON1 = 7 ' disable A/D converters ANSEL = 0 ' disable analog converters high portc.4 'Turn on LED to show PIC works pause 500 flags = 0 'Put in in case LCD not initialised on power-up pause 500 lcdout $FE,1 ' Clear LCD LCDout "Some words for test" END
Can you see what I'm doing wrong?
Bookmarks