Home
Prox / RFID
Verichips
Ladder Logic
[interfacing] †
Tube Joints
Key Code From Photo
SolveSpace (3d CAD)
SketchFlat (2d CAD)
Photographs
Miscellany
Resume / Consulting
Contact Me

LDmicro Forum - Sparkfun Serial LCD

(you are viewing a thread; or go back to list of threads)

Sparkfun Serial LCD (by Tom J.)
My device from Sparkfun has a really nice look to the display, overall I see it as a good display visually. Mine is very particular about baud rate (which I'm assuming isn't limited to just this line of devices) I had to run an external oscillator to do anything useful with it as the internal oscillator was too sloppy to provide a true 9600 baud. I'm using a PIC16F628A for the tests and a minipro programmer.

This should be applicable for any device using this "datasheet":

https://cdn.sparkfun.com/asset...SerLCD_v2_5ApplicationNote.pdf

The document has an error in the example for setting cursor position, this page was a great help to me in converting the decimal values to hexadecimal and really got things straightened out for me:

http://cactus.io/resources/too...y-octal-hexadecimal-conversion

This video shows the behaviour of the simple ladder I'm attaching, it's simple enough that between it and the application notes anyone reading this should be able to format text on this display quickly with LDMicro:

https://www.youtube.com/watch?v=45xkvGT5GE4
Sat Oct 6 2018, 03:42:51, download attachment 2linesquad.ld
(no subject) (by Tom J.)
Calling a numeric variable is proving to be a greater challenge, I've read every LCD thread here and tried every Formatted String Over UART that I could find, even wrote a few of my own and still cannot get a simple counting ladder to function properly.

Here's a video counting up to 21 with the attached ladder, which is the closest I've come to success:
https://www.youtube.com/watch?v=3X016FO_bto

Any help would be appreciated and once there's finally a proper ld for it I'll post it here so the community has this thread as a reference for the displays from this manufacturer.
Sat Oct 6 2018, 03:49:32, download attachment countingVid.ld
(no subject) (by Zoran)
I am using ld micro 4.2 and it was showing some errors try this
Sat Oct 6 2018, 10:30:56, download attachment countingREV1.ld
(no subject) (by Tom J.)
Wow, Thank You! That's a lot closer to the end game. This gives me something to tweak now.

I'm thrilled to see nothing but numbers even if there are some extra ones and it's doing the refresh a little strange.

I'll be back on this tonight.

https://www.youtube.com/watch?v=CNRQcwYg2jY&feature=youtu.be
Sat Oct 6 2018, 12:27:07
(no subject) (by MGP)
You made some programming errors.

The time that TCY is high then de seconds are counting at cycle speed and at 99 you get garbage when using \2 digitcounting.
Use the OSR command for this problem.

Don't always use the CLSCR command, it's very annoying, use the cursor commands.

Use the OSF instruction between 2 uart commands then the second must wait until the first is ready.

Attached the new version.
Sat Oct 6 2018, 13:25:27, download attachment countingVid_V2.ld
(no subject) (by Zoran)
try this
Sat Oct 6 2018, 17:47:16, download attachment countingREV2.ld
(no subject) (by Tom J.)
Had some time with this again, countingREV2.ld didn't format properly and there were mixed characters from the strings printing.

But countingVid_V2.ld did work. I rationalized the \3 was three places of numbers and tried to expand it to 6 places. Apparently there's something about a variable limit around 32,000.

My intention is to try to use this as an odometer in a custom instrument cluster so 3 digits isn't high enough. Then it dawned on me I could do two formatted strings - one after the other to get to 6 places.

Since the real unit wouldn't be starting at 0 I pulled some starting numbers out that are close to the current odometer reading and started there and it worked fantastic until the first 3 digits rolled 999 and refreshed to __1 instead of 001.

https://www.youtube.com/watch?v=5gkstOt7yeU&feature=youtu.be

I don't suppose there's a way to force the "001" ?

I'm posting the ladder from the video, I have one that "should" do a trip odometer (down to tenths of a mile I might add) on the second line but I haven't tested it since it will be prone to the same error.

I'm considering a <= rung to force a "0" to be printed if the value is below 1 on those two places.
Sun Oct 7 2018, 03:31:07
(no subject) (by Tom J.)
Forgot to attach the ladder ....
Sun Oct 7 2018, 03:33:02, download attachment countingVid_V3.ld
(no subject) (by MGP)
You cannot print 001.
You can only use 16bits integers.

And again you made the same misstake in your program, between two uart instruction you must use an OSF .

Rung 6 and 7 are send in the same time what means that you get mixed characters on your screen.
Send one rung on a OSR en the other rung on the OSF of the clock.
Sun Oct 7 2018, 03:51:19
(no subject) (by Tom J.)
I attached the wrong ladder, that was one I was toying with to see if I could position both lines.

This is where I'm at now:

https://www.youtube.com/watch?v=afwL7yKKSEQ&feature=youtu.be

I cheated and wrote a couple of rungs to look at the variable that does 0-999 and manually print a 0 to the hundreds and tens column if the variable was under 100 and under 10.

It didn't look like it was going to be pretty, the "00" was blinking with each count.
Reducing the cycle time to 2 eliminated the flicker.

Next I need to work on the next line for the TRIP odometer and persisting the two variables so this can be used for real without forgetting the mileage every time power is removed.

I feel like I'm breaking all the rules here, but I'm pretty happy with the outcome.
Sun Oct 7 2018, 20:12:34, download attachment Odometer1Line.ld
(no subject) (by Tom J.)
Looks pretty good, I may actually cheat it a bit more and do more variables instead of filling in the 0's to make it a bit smoother.

https://www.youtube.com/watch?v=jAYp2V3ECbs
Sat Oct 20 2018, 17:21:19, download attachment trip1.ld
(no subject) (by MGP)
Back the same mistake in rung 5, 6 and 7, everything is sent to the serial port in one go!

Also be careful with the persist function, officially you can only write 100 000 times, if for example you change the variable TRP frequently than it will end quickly.

But it works and that is a good thing.
Sun Oct 21 2018, 03:05:13
(no subject) (by Tom J.)
I guess I was mistaken on the amount of times it could be written. Reading the datasheet it looks like the PIC16F886 was able to be flashed 100,000 times and persistent data could be written 1,000,000 times.

"• High Endurance Flash/EEPROM Cell:
- 100,000 write Flash endurance
- 1,000,000 write EEPROM endurance
- Flash/Data EEPROM retention: > 40 years"

This could be bad news for me even at 1,000,000 times if PERSIST is called every ladder cycle and since I have multiple variables persisting the 1,000,000 could indeed come very quickly.

Is there some clarity somewhere as to how frequently the EEPROM is written?
Sun Oct 21 2018, 21:27:00
(no subject) (by MGP)
The variable is compared every cycltime with the persist data in eeprom and if there is a difference the eeprom data is overwritten.
I think you can read the eeprom data as much as you want.

You could use a supervisor & reset IC and save the eeprom data only if the ic indicates a voltage drop.
Mon Oct 22 2018, 02:39:49
(no subject) (by Tom J.)
Is it possible to call for a PERSIST?

For instance put a PERSIST on a rung with a contact and only have it write to the EEPROM when the contact is true so it doesn't write constant updates..
Mon Oct 22 2018, 04:03:31
(no subject) (by MGP)
Yes, I do this always.
Mon Oct 22 2018, 06:15:45
(no subject) (by MGP)
Here you have an example.
UP/DWN buttons and the result is stored after 500mS.

You also need the OSR instuction for the startup of the program.
Mon Oct 22 2018, 07:29:12, download attachment Snap142.jpg
(no subject) (by Tom J.)
I have the luxury of battery power and ignition switched.
I'm going to try just pulling an output high with ignition power to hold power through a transistor and when ignition power is removed run a short timing cycle to PERSIST the variables before pulling the output low and turning itself off.
That shouldn't be tricky, and I only have EEPROM writes once for each time the power is cycled.
Mon Oct 22 2018, 09:40:14
Not show error (by Amjad)
Hi Dear,
i made compressor programs but i did not understand
why it did not compiling and not running simulator and not show
any error.
Please any one solve this problem why Ldmicro doing this behave.
Thu Nov 1 2018, 15:10:57
Post a reply to this comment:
Your Name:
Your Email:
Subject:
(no HTML tags; use plain text, and hit Enter for a line break)
Attached file (if you want, 5 MB max):