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 - How to save a variable

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

How to save a variable (by Rafael Benetti)
Hi!

I'm using PIC 16F628A. Almost everything is working, but there's a problem happen when i try to save a variable in EPROM. This value isn't recoverd when PIC is powered up.

I'm sending a part of the program when i save and recoverd value.

Thanks your attention.

Rafael Benetti
Fri Jun 26 2009, 10:06:46, download attachment Cortina_COR.txt
(no subject) (by Jonathan Westhues)
There's no need to put the PERSIST op with stuff before it in the rung. That instruction will automatically save the variable only when it changes, so it's okay if its rung-in condition is just always true.

See the attached example. The inputs Xon and Xoff turn the output Yout on and off respectively, and that state is persistent across resets.

Though it's possible that persistent variables are broken for the '628A. I think the PIC16Fxxx and xxxA parts are perfectly code-compatible, but I'm not sure.
Fri Jun 26 2009, 23:53:11, download attachment persist.ld
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):