PICAXE CONTROL OF SERIAL LCD - PAUSE COMMAND
sailgene
Posts: 12
Hello. I purchased a 4 X 20 Parallax LCD serial display for a project. I have no problem sending a serout command to place some text onto the LCD. But if I place a pause command any longer than 2 seconds between additional serout commands, the LCD seems to freeze up. I've tried sending another "high" command to the LCD but to no effect.
Example: HIGH C.3
PAUSE 10
SEROUT C.3, T9600_8, ("SENSORS ON LINE")
PAUSE 2000
SEROUT C.3, T9600_8, (12,22)
PAUSE 75
SEROUT C.3, T9600_8, ("HELLO DAVE")
I'm sending a "high" command on pin c.3 to get this going and it works fine. But if I increase the pause command to 3000 (3 seconds), all I get is the first line (SENSORS ON LINE) followed with a backslash (\). The screen then freezes up.
I should add that I'm sending this data over a 150' line using MAX485 chips. If I hook up the LCD directly to the Picaxe, it works fine.
Any help would be appreciated. Thanks.
Example: HIGH C.3
PAUSE 10
SEROUT C.3, T9600_8, ("SENSORS ON LINE")
PAUSE 2000
SEROUT C.3, T9600_8, (12,22)
PAUSE 75
SEROUT C.3, T9600_8, ("HELLO DAVE")
I'm sending a "high" command on pin c.3 to get this going and it works fine. But if I increase the pause command to 3000 (3 seconds), all I get is the first line (SENSORS ON LINE) followed with a backslash (\). The screen then freezes up.
I should add that I'm sending this data over a 150' line using MAX485 chips. If I hook up the LCD directly to the Picaxe, it works fine.
Any help would be appreciated. Thanks.
Comments
temp = 10
PAUSE temp
or
temp = 2000
PAUSE temp
where temp is declared as a 16-bit word
Sorry for asking obvious questions:
Picaxe side:
-- DE and RE\ tied together and pulled down?
-- 120-ohm terminator across twisted pair?
LCD side:
-- DE and RE\ tied together and pulled up?
-- pull-up on RO (to LCD)?
-- 120-ohm terminator across twisted pair?
Looking at other Picaxe serial LCD examples, it seems that typically an 'init' is use dto wait for the LCD to initialize before checking the LCD
EX:
INIT: PAUSE 500
Example: HIGH C.3
PAUSE 10
.
.
.
Have you tried pulling out the MAX485 chips and communicating with the LCD directly?
Could this possibly be a clock or watchdog timer issue with the Picaxe where the Picaxe has gone into some sort of sleep state?
Sorry, just spit balling.
The max 485 chips perform fine in my other serial communication such as turning a pin on "high" or even pwm functions. It's just the LCD.
In another forum, I was asked if the Parallax LCD's interface had some sort of a built-in timeout function? So that if there was a delay in receiving data, the display would simply stop accepting new data. However, it still works great when tied directly to the Picaxe chip.
So it seems something is being lost in the transmission - perhaps some delay in receiving the first byte, etc.
But thanks for spit-balling.
Have you tried the RS485 line drivers with a shorter line ... maybe just a few inches?
You also want to ensure the end of the signal path is properly terminated.
You might already have this info, but here are a couple of links with connect info for the RS485:
https://maximintegrated.com/en/app-notes/index.mvp/id/3884
forum.arduino.cc/index.php?topic=363197.0
INIT:
PAUSE 1000 'ALLOW SPLASH SCREEN TO CLEAR
DISCONNECT
SETFREQ M8 'IF PROBLEM, CONSIDER CALIBFREQ 2 TO 4
PAUSE 10
HIGH C.3 'HIGH TO START ACTION??
PAUSE 10
SEROUT C.3, T9600_8, (22) 'CLEAR SCREEN, CURSOR AND TURN ON BACKLIGHT
PAUSE 75 'ALLOW MINIMUM 5MS AFTER CLEAR SCREEN COMMAND
SEROUT C.3, T9600_8, (12)
PAUSE 75
SEROUT C.3, T9600_8, (17) 'CLEAR SCREEN, CURSOR AND TURN ON BACKLIGHT
PAUSE 75
SEROUT C.3, T9600_8, ("SENSORS")
SEROUT C.3, T9600_8, (" ON")
SEROUT C.3, T9600_8, (" LINE")
PAUSE 1000
MAIN:
FOR B1 = 1 TO 25
SEROUT C.3, T9600_8, (12,22)
PAUSE 75
SEROUT C.3, T9600_8, ("BATTERY = ")
PAUSE 75
SEROUT C.3, T9600_8, ( #B1)
PAUSE 75
SEROUT C.3, T9600_8, (13) 'CLEAR SCREEN, CURSOR AND TURN ON BACKLIGHT
PAUSE 5
SEROUT C.3, T9600_8, ("HOW")
SEROUT C.3, T9600_8, (" DO")
SEROUT C.3, T9600_8, (" YOU")
SEROUT C.3, T9600_8, (" DO")
PAUSE 2000
NEXT B1
END
Have you tried using the custom character options with the LCD to store items just as "BATTERY =" and such?
Do you need to turn the display on for each iteration of the MAIN loop?
"SEROUT C.3, T9600_8, (12,22)"
LCD Commands are listed in:
https://parallax.com/sites/default/files/downloads/27979-Parallax-Serial-LCDs-Product-Guide-v3.1.pdf
It seems that if I instruct the Picaxe to do anything but send constant text messages, the LCD seems to time out and stop receiving updates. I've run a "counter" program with the variable showing as it incremented from 1 to 25. It would typically stop around 3 or 4 but then jump to 12 or more as if it stopped reading the incoming data and then restarted reading it.
So that's the latest. And thanks so much for trying to help me out. Are there any examples of code out there that involve RS232 or RS485 communication along with additional program commands besides text?
If not, I'll keep messing with the pause timing to see if longer "off" cycles improves anything.
Thanks again. I'm developing a slight case of "hope".
150 feet!
How are you getting power to the LCD? ie are you feeding 5v 150 feet? if so maybe you are suffering from IR drop.
Just a thought.
Dave
It may be that your Form Feed keeps the display interface busy for 5mS and the "display on" code gets ignored or partially ignored so the following characters' timing is off. Eventually a "display on" code is seen and processed and the display turns on.
You may have problems with line noise or reflections if you don't have proper termination resistors or if your 5V supply for the RS485 receiver is noisy.
Mike, is there any around the "form feed" command or is 5 ms the minimum amount of time I can use for that function?
Gene
But perhaps the LCD is very sensitive to line noise or transmission timing - I don't know. But I'm about out of patience. A few more tries and then I'm purchasing a competitors model and writing a less-than-positive review on this LCD.
But thanks to everyone for trying to help me out.
Gene
Edit:
Hi Gene, I just re-read your first post where you state:
"I'm sending this data over a 150' line ... the LCD directly to the Picaxe works fine."
So if you take out the 150' run, it functions like it should? If that's the case, then it doesn't sound like the LCD itself is at fault like I first thought. Either the picaxe can't push the signal that far, or the noise threshold is too high for the signal to get through.
As a real world example, even something like HDMI needs a signal booster in the line after a 50 ft. run.
Definitely try slowing the baud rate as low as it can go like Tom suggests below. We used to have to do that on modems in Alaska when I was a teen because the line noise was so bad. Maybe it will work for this.
Edit: Not so much As a fix as to get a data point.
It's a serial device for crying out loud. If there is line noise, or a problem with the bits going from point A to point B, it's your fault for the junk transmission line between that controller and the display.
You are cracking me up, I just blew milk out of my nose while reading your last post on this thread.
The crazy part was that I'd get some information which, after locating the fault, is totally surprising. Would have simply expected nothing or at the best, garbled data.
So anyway, thanks to all of you for trying to help me out.
Welcome to my world! I use (need) reading glasses to solder now, and I keep a 10X loupe handy to check all connections before powerup.
Recommended for all ages! For just 78 cents, order several, since they do walk off.
https://www.ebay.com/itm/142581615197
BTW, glad to hear you solved your problem. It takes a big man to loop back and admit he made the mistake.
I may try it sometime.