How Can We Help?

Print

Counter

 

Counter causes an Integer Tag to increment (or decrement) when a specific Bit Tag changes value.

  • Can count up to about 3 kHz (180 000 pulses/min).
  • You can have as many counters as available inputs.
  • For more than 3 kHz, see MotionIn which can up to 250 kHz.

Counter is a background task. When a Counter set to ‘counts up’ or ‘counts down’ is executed, it’ll continue counting until a Counter with the same Output Tag, set to ‘stop counter’ is executed.

You don’t have to execute this command every time you want it to increment or decrement. Execute it when you want to start, stop or change the Counter.

The ‘Output’ is the value that will count up or down. It can be of any Integer type (UI8, UI16, I16 or I32).

The other input box is for the Bit Tag that will cause the Output to count up or down. It isn’t needed for ’stop counter’.

‘rise’ causes Output to count when your Bit Tag goes from value 0 to 1.

‘fall’ causes Output to count when your Bit Tag goes from value 1 to 0.

 

 

Here, we will show how to have a state for execute a task only once, from top to bottom of the cycle, when the PLC boots.

This state will never run again until the next boot. Usually used to initialize variables.

  • SET a Coil in the beginning of your program
  • Use this BIT and the Rising edge contact

 

Example how to use the counter

ColdStart (or any other bit name) is used for one-time execution of tasks

 

 

 

 

Just for reset the counter

 

 

 

If it’s necessary (the reset is not enough), you can stop the counter.
To be executed just once

 

 

 

If you have stopped the counter, you can restart it
To be executed just once.

 

 

 

We set ColdStart to 1 so that we don’t re-run tasks that only need to be done once.

 

.