Re: help with 4 x 20 LCD
.....it looks more like Klingon or Greek.
because you still have it wrong
DEFINE LCD_DREG PORTD
DEFINE LCD_DBIT 4 from manual ' Set starting Data bit (0 or 4) if 4-bit bus
DEFINE LCD_RSREG PORTE
DEFINE LCD_RSBIT 0
DEFINE LCD_EREG PORTE
DEFINE LCD_EBIT 1
DEFINE LCD_RWREG PORTE
DEFINE LCD_RWBIT 2
DEFINE LCD_BITS 8 from manual Set LCD bus size (4 or 8 bits)
The LCD may be connected to the PIC MCU using either a 4-bit bus or an 8-bit
bus. If an 8-bit bus is used, all 8 bits must be on one port. If a 4-bit bus is used,
the top 4 LCD data bits must be connected to either the bottom 4 or top 4 bits of
one port.
DEFINE LCD_LINES 4
DEFINE LCD_COMMANDUS 2000
DEFINE LCD_DATAUS 50
the one thing not mentioned in the manual is to ground the unused pins d0-d3 if using a 4 bit bus.
it can be difficult to init disp under some conditions if this is not done.
if you use 8bit bus then the pins should be connected sequentially port.0 -> d0 ..... port.7 -> d7
Last edited by richard; - 23rd February 2018 at 21:10.
Warning I'm not a teacher
Bookmarks