PDA

View Full Version : LCD in 8-bit mode



thesaxmachine
- 7th April 2006, 07:46
Hello,
What is the code to setup a PIC to drive an LCD in 8-bit mode. In the PicBasic manual it only shows how to change the port the 4 bit mode is on.

Thanks

-Albert

paul borgmeier
- 7th April 2006, 08:10
See manual again (it's all there) and try this:

'Below defines make:
'PortA.0 = enable
'PortA.1 = select
'PortB = the 8 bit bus
'Adjust to meet your needs ...

DEFINE LCD_DREG PORTB ' Set LCD Data port
DEFINE LCD_DBIT 0 ' Set starting Data bit (0 or 4) if 4-bit bus
DEFINE LCD_RSREG PORTA ' Set LCD Register Select port
DEFINE LCD_RSBIT 1 ' Set LCD Register Select bit
DEFINE LCD_EREG PORTA ' Set LCD Enable port
DEFINE LCD_EBIT 0 ' Set LCD Enable bit
DEFINE LCD_BITS 8 ' Set LCD bus size (4 or 8 bits)
DEFINE LCD_LINES 2 ' Set number of lines on LCD
DEFINE LCD_COMMANDUS 2000 ' Set command delay time in us
DEFINE LCD_DATAUS 50 ' Set data delay time in us

Good Luck,
Paul Borgmeier
Salt Lake City, Utah
USA