PLC Programming: a timer that can pause and resume.

Our PLC has defined T0-T255 timers that can be used to take a certain actions on a count down. Those timers’ resolutions can be 100ms, 10ms or 1ms. Here’s a sample of how these timers are used:

The problem with these timers is that once the timer has started, it’ll have to run its full course, there’s no way to pause it. But in real life, there are times that we would like to pause for something else, then come back and resume our job. For a task like that, reserved register M011, M8012,  M8013 and M8014 would come in handy. These three addresses are pulse clock that would turn on and off everything 100m for M8012, 1s for M8013, 10ms for M8011 and 1 minute for M8014, which can be used as a pulse for countdown.

The following code takes M1 and M8012 as condition for counter c0. If M1 is on, counter C0 would count 1 everything 100ms.  Exactly 10 seconds have passed when counter C0 comes to 100. You can turn off M1 to pause the counting, then resume it by turning it back on.