Hi, I've read all the posts and cannot find any help with directly connecting a LCD 16x2 display to a picaxe 28X (not a module display). I am using it in 4-bit mode and I wrote my own initiliastion code. As follows. RS is on PORTC 4 and SE is on PORTB 5. And DB4-7 on PORTC 0 - 3 respectivley. DB0-3 are grounded.
init:
let pinsc = 0
pause 30
'Function Set
let pinsc = %00000010
pulsout SE,1
let pinsc = %00000010
pulsout SE,1
let pinsc = %00001100
pulsout SE,1
pause 10
'Display ON/OFF
let pinsc = %00000000
pulsout SE,1
let pinsc = %00001110
pulsout SE,1
pause 10
'Display Clear
let pinsc = %00000000
pulsout SE,1
let pinsc = %00000001
pulsout SE,1
pause 10
'Entry Mode Set
let pinsc = %00000000
pulsout SE,1
let pinsc = %00000111
pulsout SE,1
Then to write a char I use this with variable in b1;
writeChar:
let b2 = b1 & 15
let pinsc = b2
high portc RS
pulsout SE,1
let b2 = b1 / 16
let b3 = b2 & 15
let pinsc = b3 'b2 & 15
high portc RS pulsout SE,1 return
I dont know if its initilising as when I run the code the LCD goes blank for about 8 seconds then the cursor pops up and moves right one character everytime I try and write a character to the LCD display. But it does not show the character i want to display (its blank). Can anyone suggest if im initilising correctly and if my writeChar sub is correct?
Thanks, Glenn G
init:
let pinsc = 0
pause 30
'Function Set
let pinsc = %00000010
pulsout SE,1
let pinsc = %00000010
pulsout SE,1
let pinsc = %00001100
pulsout SE,1
pause 10
'Display ON/OFF
let pinsc = %00000000
pulsout SE,1
let pinsc = %00001110
pulsout SE,1
pause 10
'Display Clear
let pinsc = %00000000
pulsout SE,1
let pinsc = %00000001
pulsout SE,1
pause 10
'Entry Mode Set
let pinsc = %00000000
pulsout SE,1
let pinsc = %00000111
pulsout SE,1
Then to write a char I use this with variable in b1;
writeChar:
let b2 = b1 & 15
let pinsc = b2
high portc RS
pulsout SE,1
let b2 = b1 / 16
let b3 = b2 & 15
let pinsc = b3 'b2 & 15
high portc RS pulsout SE,1 return
I dont know if its initilising as when I run the code the LCD goes blank for about 8 seconds then the cursor pops up and moves right one character everytime I try and write a character to the LCD display. But it does not show the character i want to display (its blank). Can anyone suggest if im initilising correctly and if my writeChar sub is correct?
Thanks, Glenn G