In this tutorial, you will learn how to use counters. If you missed it, check out the last post where we explain how to download and install a GSDML file.
Parts Required
Software:
- Siemens TIA Portal
Hardware:
- s7-1200 1214 DC/DC/DC PLC
Counters
On Tia portal, we are able to use three different counters:
- CTU (Counter UP);
- CTD (Counter Down);
- CTDU (Counter Down and UP);
The counters are able to use in basic instruction’s separator in counter operation as you can see in Figure [1].

The counters need to have a unique name data base. When you drop the counter on network, will appear a window where you can give a name to counter data base.
Counter UP (CTU)

The counter UP Block have 3 Inputs and 2 Outputs, as you can see in Figure[2].
The CU it’s a Boolean input and represents the line that can increment the value when a positive signal edge was received. The R it’s a Boolean input and represent the line that can reset the value when a positive signal edge was received. The PV it’s an Integer input and represent the setpoint that you can change to activate the output of the counter.
The Q it’s a Boolean output and its activate when the counter value its greater or equal to the value that you insert in PV input. The CV it’s a integer output where you can check the current counter value.
Counter Down (CTD)

The counter Down Block have 3 Inputs and 2 Outputs, as you can see in Figure[3].
The CD it’s a Boolean input and represents the line that can decrement the value when a positive signal edge was received. The LD it’s a Boolean input that sends the PV setpoint to the CV output when a positive signal edge was received. The PV it’s an Integer input and represent the setpoint that you can send to the output of the counter.
The Q it’s a Boolean output and its activate when the counter value its less than or equal to zero. The CV it’s a integer output where you can check the current counter value.
Counter Down and UP (CTDU)

The counter Down and Up Block have 5 Inputs and 3 Outputs, as you can see in Figure[4].
The CU it’s a Boolean input and represents the line that can increment the value when a positive signal edge was received. The CD it’s a Boolean input and represents the line that can decrement the value when a positive signal edge was received. The R it’s a Boolean input and represent the line that can reset the value when a positive signal edge was received. The LD it’s a Boolean input that sends the PV setpoint to the CV output when a positive signal edge was received. The PV it’s an Integer input and represent the setpoint that you can change to activate the output of the counter.
This is the seventh post on the Siemens TIA Portal. You have learned what is GSD file, how to download it, and how to install it.
If you like this kind of post, if you want to know more about Siemens TIA Portal, or if you have doubts about the Industrial Automation area don’t forget to leave a comment. You can also send me a message on LinkedIn