Hello,
I completed a project where I drive successfully a 2x16 character LCD at 4 and 8 MHz. Now I added a 16 MHz quartz and, despite all the pulseout command have been extended to 4, the initial 4 characters on the first line have strange values. Analyzing the issue I reduced the code just for writing the letter C on the first position; it works ok at 4 and 8 MHz but not at 16 MHz. Inserting pauses and increasing pulse durations does not help.
Here the code:
//code
setfreq em16
lcdinit:
let pins=0
pause 800
let pins=48
pulsout 3,4
pulsout 3,4
pause 40
pulsout 3,4
pulsout 3,4
let pins=32
pulsout 3,4
pulsout 3,4
let pins=128
pulsout 3,4
b1=14
gosub wrins
b1=1
gosub wrins
main:
let b1="C"
gosub wchar
b1=128
goto main
wrins:
let pins= b1&240
pulsout 3,40
let b2=b1*16
let pins=b2&240
pulsout 3,40
high 2
return
wchar:
let pins=b1&240
high 2
pulsout 3,4
let b2=b1*16
let pins=b2&240
high 2
pulsout 3,4
return
//endcode
Thank you for your help
I completed a project where I drive successfully a 2x16 character LCD at 4 and 8 MHz. Now I added a 16 MHz quartz and, despite all the pulseout command have been extended to 4, the initial 4 characters on the first line have strange values. Analyzing the issue I reduced the code just for writing the letter C on the first position; it works ok at 4 and 8 MHz but not at 16 MHz. Inserting pauses and increasing pulse durations does not help.
Here the code:
//code
setfreq em16
lcdinit:
let pins=0
pause 800
let pins=48
pulsout 3,4
pulsout 3,4
pause 40
pulsout 3,4
pulsout 3,4
let pins=32
pulsout 3,4
pulsout 3,4
let pins=128
pulsout 3,4
b1=14
gosub wrins
b1=1
gosub wrins
main:
let b1="C"
gosub wchar
b1=128
goto main
wrins:
let pins= b1&240
pulsout 3,40
let b2=b1*16
let pins=b2&240
pulsout 3,40
high 2
return
wchar:
let pins=b1&240
high 2
pulsout 3,4
let b2=b1*16
let pins=b2&240
high 2
pulsout 3,4
return
//endcode
Thank you for your help