Timer 0 Retentive (by Kumar)
Dear Johnathan,
Kumar here. There is an application, where i've to use retentive timer for control using 16F628A. The sequence goes like this:
----------------------------------------------[PERSIST TO]
|
-----------|XRA2|------|XRA3|-----------------(TO 10SEC.)
| |
-----------|R1000|----
|
-----------|T0|-------------------------------(YRB0)
But the thing is, it does not work correctly. Could you help me how to solve the problem? Please reply.Thanks.
(no subject) (by Kumar)
To MGP,
This is the LD.file that you've asked for. Actually the problem is, the value of the TO could not be saved in EEPROM. This is because, sometimes when the power is switched OFF & ON again, the value of the TO is something goes to like zero. It couldn't hold the last value before the power down. So, is there any mistakes in the ladder sequence?. Please check & reply. Thanks.
(no subject) (by MGP)
Kumar,
You cannot do that because TO{persist} IS NOT EQUAL TO(timer)
These are two different things
As for the timer, if you turn off the power then the timer is no longer a timer.
The timer always resets on power up.
As for TO{persist} (variable) you must use the instructions that are applied to variables
The manual also says :
If a variable that changes frequently is made persistent, then the
EEPROM in your micro may wear out very quickly, because it is only good for a limited (~100 000) number of writes.
So be carefull
Now your problem: You need a circuit that detects a power down connected to an input pin that triggers a MOVE instruction.
Use a countup or countdown instruction and a set-reset coil for your pseudo retentive timer.
But how do you gonna restore the T0 variable to 10 sec after you have changed the TO variable to another value?
(no subject) (by Kumar)
To MGP,
Kumar here. I think there are some mistakes in the sequence. I didn't add that sequence, like what you've said about the
restoring the TO variable, when it change to another value. So, i'm also feel it will be better way to use the counters & SET/ RESET for this timing purpose. As what you've said, T0 persist & T0 are not equal. I will change the sequence & try with that one. I will come back to you, if any error arise. Anyway, thanks a lot for your reply.