So i am a EE and mostly work in protections. I recently got thrust into more of a controls roll and need to start learning some logic.
What better place to start then making something blink
Im using RS5000 and a compact logix rack to mess around
I built this tiny little simply bit of logic.
I assumed the done bit of the TON timer would trigger my timer reset coil
Alas it will not work.
If i remove the reset the timer works fine of course. If i replace the reset with just a memory bit the done bit will toggle when the timer is done
However, when the reset is in place, the accumulator never reaches 1000 and the done but never turns on. However the timer somehow manages to reset itself and start over. I have no clue how
Can someone explain to me what is going on
[/URL][/IMG]
To fully understand this, what better place to start than for
you to act as the processor of the code.
Take each instruction as it occurs in your much slower timescale, then amplify it to the speed at which the code is actually executed.
The following is a roundup, the numbering is rung:instruction
0:1 Read that the tag "test" is true
0:2 Enable the timer. Note that enabling the timer, or even the presence of the timer instruction, has no effect on the rung condition true or false, so the timer's "Enable_In" is mapped to the timer's "Enable_Out".
0:3 The rung is true, so the OTE instruction writes a "1" to the output tag.
1:0 Inspect the timer's DN bit, on this and many more scans, it will be false, so the rung logic continuity (RLC) becomes false
1:1 The previous instruction made the RLC false, so the RES instruction does nothing.
Now we need to skip a few thousand scans of the logic, nothing is ever "held up" waiting for timers etc.
Some time later, in this case XXXX mS...
0:0 "test" is still true, so pass RLC = True to the next instruction.
0:1 The timer remains enabled, but this time around, it has reached or exceeded its preset time period, and it turns on its .DN flag... but still the Enable-In is passed through to the Enable_Out, nothing has made the rung false, so RLC = True
0:2 RLC being True, the OTE again writes a "1" to the output bit (which it has done every single scan of the logic up to now).
1:0 The XIC of the .DN bit is now true, so RLC = True is passed to the next instruction.
1:1 RLC is now true, so the timer is reset.
On the next scan of the logic....
0:0 "test" is still true, so RLC true is passed to the next instruction...
0:1 RLC is true, so the timer is enabled, RLC true is passed to the next instruction...
0:2 RLC is true, so the OTE writes a "1" to the output tag.
Repeat ad nausiem...
Summarising - It is clear from the above narrative, if you can get your head around it, that
at no time, ever, does the rung logic continuity ever become false to write a "0" to the output tag, so that tag will never become "false", even for a few microseconds, there simply isn't a case where it is ever turned off.
Have you noticed that the only thing that ties the instructions together is the current state of the rung, the RLC ?
Instructions in the code
do not know what precedes them,
or what succeeds them, they are only told what the RLC is, and they may, or may not change the RLC. There is a definition that "conditional" instructions (i.e. "test something")
can change the RLC, but "unconditional" instructions (i.e. "do" something")
cannot change the RLC. In your example the timer is an unconditional "do" instruction, which maintains RLC.