mikevandebeld
- 17th December 2011, 03:33
Hi,
This may be something that I am simply overlooking but I have spent too much time trying to figure it out. I have 4 lcds. Two are using the KS0066U controller and the other two are using the Hitachi 44780 which I believe are the same anyways. One is built in a Picdem 2 plus board and the others I have wired to the board. The built in one uses port d and a 4 bit data bus. I can get it to work no problem. I wire the other three to port b the exact same way as the built in lcd as I have the schematic to the picdem board and they will not work at all. What I am hoping is some insight on what may be going wrong for me. My exact code is below. The first set of defines is for the picdem board lcd and the other is for the wired lcd.
I am obviously missing something and any advice or suggestions would be greatly appreciated.
DEFINE OSC 4
' TRISD = %00000000
' Pause 500 ' Wait for LCD to startup
' DEFINE LCD_DREG PORTD
' DEFINE LCD_DBIT 0
' DEFINE LCD_RSREG PORTD
' DEFINE LCD_RSBIT 4
' DEFINE LCD_EREG PORTD
' DEFINE LCD_EBIT 6
' DEFINE LCD_BITS 4
' DEFINE LCD_LINES 2
' DEFINE LCD_COMMANDUS 2000
' DEFINE LCD_DATAUS 50
' Low Portd.5 'r/w low
' High Portd.7 'power on the lcd
TRISB = %00000000
PORTB = %00000000
TRISC = %00000000
PORTC = %00000000
'High Portc.1 'turn on the led
'High Portc.2
Pause 500 ' Wait for LCD to startup
DEFINE LCD_DREG PORTB
DEFINE LCD_DBIT 0
DEFINE LCD_RSREG PORTB
DEFINE LCD_RSBIT 4
DEFINE LCD_EREG PORTB
DEFINE LCD_EBIT 5
DEFINE LCD_BITS 4
DEFINE LCD_LINES 2
DEFINE LCD_COMMANDUS 2000
DEFINE LCD_DATAUS 50
startup:
'High Portc.1 'status led
High Portc.1 'lcd light
Lcdout $fe, 1
Lcdout "Hello"
Pause 1000
Lcdout $fe, 1
Lcdout "World"
Low Portc.1
Pause 4000
goto startup
end
This may be something that I am simply overlooking but I have spent too much time trying to figure it out. I have 4 lcds. Two are using the KS0066U controller and the other two are using the Hitachi 44780 which I believe are the same anyways. One is built in a Picdem 2 plus board and the others I have wired to the board. The built in one uses port d and a 4 bit data bus. I can get it to work no problem. I wire the other three to port b the exact same way as the built in lcd as I have the schematic to the picdem board and they will not work at all. What I am hoping is some insight on what may be going wrong for me. My exact code is below. The first set of defines is for the picdem board lcd and the other is for the wired lcd.
I am obviously missing something and any advice or suggestions would be greatly appreciated.
DEFINE OSC 4
' TRISD = %00000000
' Pause 500 ' Wait for LCD to startup
' DEFINE LCD_DREG PORTD
' DEFINE LCD_DBIT 0
' DEFINE LCD_RSREG PORTD
' DEFINE LCD_RSBIT 4
' DEFINE LCD_EREG PORTD
' DEFINE LCD_EBIT 6
' DEFINE LCD_BITS 4
' DEFINE LCD_LINES 2
' DEFINE LCD_COMMANDUS 2000
' DEFINE LCD_DATAUS 50
' Low Portd.5 'r/w low
' High Portd.7 'power on the lcd
TRISB = %00000000
PORTB = %00000000
TRISC = %00000000
PORTC = %00000000
'High Portc.1 'turn on the led
'High Portc.2
Pause 500 ' Wait for LCD to startup
DEFINE LCD_DREG PORTB
DEFINE LCD_DBIT 0
DEFINE LCD_RSREG PORTB
DEFINE LCD_RSBIT 4
DEFINE LCD_EREG PORTB
DEFINE LCD_EBIT 5
DEFINE LCD_BITS 4
DEFINE LCD_LINES 2
DEFINE LCD_COMMANDUS 2000
DEFINE LCD_DATAUS 50
startup:
'High Portc.1 'status led
High Portc.1 'lcd light
Lcdout $fe, 1
Lcdout "Hello"
Pause 1000
Lcdout $fe, 1
Lcdout "World"
Low Portc.1
Pause 4000
goto startup
end