So, what do we need to do to fix the logic?
We see that the timer ran once and stopped. We wanted it to run to the preset value and then restart.
To do this, we need to add an “XIO” instruction, so that when the timer preset is reached and the “DONE” bit is set, the timer is reset and starts over again.
Using an “XIO” instruction will make the rung go false when the “DONE” bit is set, thereby resetting the timer. Resetting the timer also resets the “DONE” bit, so the rung will go true again and start the timer.
When timer logic is set up to continuous run and reset, we often refer to this as a “free-running” timer.
This time, when the timer times out, the counter increments, and the timer resets and begins timing again. Every five seconds, the value in “N7:0” increments. When the value reaches 10, “N7:0” is set back to zero, just as we had wanted.