LCD with 28X1 at 16 MHz

Benjie

Senior Member
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
 

westaust55

Moderator
try adding a 0.5 second pause before sending the first commands to the LCD to give the LCD time to internally initialise.

EDIT:
Okay, likely that will not help since on rereading it seems you do get correct characters after the first 4 characters indicating the LCD has initialised correctly.


Also, instead of //code and //endcode, if you use the tags [code] and [/code] your program code listing will appear in the sub window as used by most forum users.

EDIT2:
From a quick glance, in the wrins: subroutine you have HIGH 2 at the end which I assume (lack of helpful comments) is setting the RS pin high.
But at the start of the wrins: subroutine you do not set pin 2 LOW. So even for the second call to wrins: in the initialisation phase, pin 2 will remain high.
What happens if you add LOW 2 immediately after the wrins: label ?
 
Last edited:

jtcurneal

Senior Member
Try these suggestions.

With the LCDs that I usually use, The Enable signal pulse width only has to be more than 230 nanoseconds,
a much longer Enable pulse is not necessary.

In your wrins: routine
try reducing your pulsout from 40 to 4 ( 2 should be more than enough at 16 Mhz ) like you have on your wrchr: routine.

The Clear display and the Return home commands require a couple of miliseconds to complete.

Try a pause 20 after the second pulsout command in your wrins: routine.

Joel
 

Technical

Technical Support
Staff member
But at the start of the wrins: subroutine you do not set pin 2 LOW. So even for the second call to wrins: in the initialisation phase, pin 2 will remain high.
WA55 - 'let pins =' sets it low

As suggested above, it is likely that commands like 'clear display' simply need a longer time to process.
 

Benjie

Senior Member
Jael, your suggestion of a pause of 20 after the second pulseout of the wrins routine solved the problem. The suggestions of westaus55 and Technical didn't make any difference. Thanks to all of you now my system can run at 16 MHz.

You deserve a quick glance to my project: I have a 433 mHz transmitter module in the shack providing the data to one or several remote antenna tuners installed at the base of multiband antennas. The module provides the data for two variable capacitors and 8 bistable relays which provide the correct impedance transformation for each antenna for a given band. The LCD gives the values of the transmitted data.
The receivers are supplied via the RF feed line only when that particular antenna is selected and only during the adjustment of the tuner for a given band at low power RF. Once the adjustment is completed, the 12V power is removed leaving the variable capacitors at their last position as well as all the relays. High RF power can be applied to the tuner without affecting the low voltage (28X1) components.

Now my system will work also at 16 MHz speed. Thanks again.

Anselmo
 
Top