I've had a break from PIC's for a little so I'm a bit rusty, but I don't recall having this many issues in the past.
Just trying to get an LCD to work first on my 16F716. I haven't used this pic before so might have some config wrong.
B4-B7 goto DB4-DB7 on my 2-line LCD
RW is held low VIA code, Enable and RS are on corresponding pins.
The issue is that I get mostly jibberish all over the screen changing constantly, with glimpses of the text I'm trying to put there. I've mostly used 4-line LCD's before so don't even know if I have the addressing right, I dont' have a datasheet for this exact LCD
I have tried fiddling the COMMANDUS and DATAUS values but they haven't had an effect, even without them there.
Just trying to get an LCD to work first on my 16F716. I haven't used this pic before so might have some config wrong.
B4-B7 goto DB4-DB7 on my 2-line LCD
RW is held low VIA code, Enable and RS are on corresponding pins.
The issue is that I get mostly jibberish all over the screen changing constantly, with glimpses of the text I'm trying to put there. I've mostly used 4-line LCD's before so don't even know if I have the addressing right, I dont' have a datasheet for this exact LCD
I have tried fiddling the COMMANDUS and DATAUS values but they haven't had an effect, even without them there.
Code:
@ __CONFIG _WDT_ON & _RC_OSC & _PWRTE_ON
' Define LCD registers and bits
DEFINE LCD_DREG PORTB
DEFINE LCD_DBIT 4
DEFINE LCD_RSREG PORTB
DEFINE LCD_RSBIT 3
DEFINE LCD_EREG PORTB
DEFINE LCD_EBIT 1
DEFINE LCD_LINES 2
DEFINE LCD_COMMANDUS 1500 'defines the delay after LCDOUT statement
DEFINE LCD_DATAUS 44 'delay in micro seconds
TRISA = %11111
TRISB = %00000000
butdn var porta.4
butup var porta.3
butmode var porta.2
bail2 var porta.0
bail3 var porta.1
clutch var portb.0
lcdrw var portb.2
c var word
c = 0
lcdrw = 0
pause 150
lcdout $fe,1
pause 500
Start: '************************************************************************ START
c = c + 1
lcdout $fe,1
lcdout $fe,$00,"This is a test "
lcdout $fe,$40,DEC c
pause 500
if c > 100 then
c = 0
endif
GOTO start