In addition to comparisons, counters are the second important group of functions. It can be counted in two ways, forwards and backwards. If the set value is reached, an output is switched on (HIGH), if the value falls below the set range, the output is switched off (LOW).
With the counters of "plcladdersimulator2", in contrast to many other ladder diagram software, can also be counted negatively. The counter does not stop at 0 but rather. then counts -1, -2, -3 etc.
If you insert a counter, a dialog window opens.
- C file is a consecutive number, i.e. counter 1, counter 2, counter 3, etc.
- Preset, is the value at which the output is switched on or off (HIGH / LOW)
Up counter. As the name suggests, the up counter can only be used to count "up" or "+". +1 is counted with each pulse at the input.
- Entrances
- CU, "counter up" is the counter input, with every "HIGH" edge change +1 is calculated
- RESET, with a "HIGH" edge the counter is set to the value 0
Output C: 0CU always has the same state as input CU, so this contact always "mirrors" the counter input and can thus continue to be used in the controller.
The output C: 0DN is switched on (HIGH) if Preset and Accum are equal or Accum is higher than Preset. If the set value (here 10) is reached or exceeded or the output remains (HIGH).
Up and down counters. This counter has a further input "CD, counter down". If this input has a "HIGH" edge, -1 is calculated. So you can count forwards and backwards or up and down.
The outputs remain the same. The output CU is the same as the input CU.
The CD output is the same as the CD input.
The counter is reset to 0 (zero) via RESET.
The output DN is switched if the preset is equal to or greater than Accum.