Hello,
I am having great difficulty getting a newhaven 20x4 LCD working on my 18LF66K80 in 4 bit mode. When using PORTA.0-3, once one bit of data is set, it gets unset before the next is set. I have temporary solved that by embedding assembler which achieves the same thing, however I am getting a persistent problem where the display just shows 2 rows of vertical lines.
I also get similar results from using LCDOUT, where basically when I set all the bits suitably it "just doesn't work" with similar effects to above.
I am confident with the wiring as we have another PIC with the same code written in C (albeit 8bit) working perfectly.
Code:
D4-7 are on RA0-3 respectively
RW is on RF3
RS is on RF2
E0 is on RA5
The following are the defines I tried for LCDOUT.
Code:
DEFINE LCD_DREG PORTADEFINE LCD_DBIT 0
DEFINE LCD_RSREG PORTF
DEFINE LCD_RSBIT 2
DEFINE LCD_REREG PORTF
DEFINE LCD_RWBIT 3
DEFINE LCD_EREG PORTA
DEFINE LCD_EBIT 5
DEFINE LCD_BITS 4
DEFINE LCD_LINES 2
DEFINE LCD_COMMANDUS 2100
DEFINE LCD_DATAUS 500
An example of the code I am using to display some text is below:
Code:
Main:
LCDOut $fe,1:FLAGS=0:Pause 250
LCDOUT "Hello World"
pause 2000
goto Main
Any help getting to the bottom of this would be hugely appreciated!
Bookmarks