How to use Siemens TIA Portal to create Different Counter blocks in PLC?
- Graphical representation of different Counter used in Siemens TIA Portal
- Different Counter blocks usage in PLC Ladder Logic
- Declaration of Input and Output of different Counter PLC blocks
- Different Phases of PLC Ladder Logic of Counter Block Operation
- Simulation screenshots of different type of Counter blocks
In this article, we are going to see different types of counters used in the Siemens TIA Portal. The following Image shows the usage of counters in the industry process.
The Siemens TIA Portal Timers are:
- CTU – UP Counter
- CTD – Down Counter
- CTUD – Up Down Counter
Graphical representation of different Counter used in Siemens TIA Portal
Different Counter blocks usage in PLC Ladder Logic
CTU – UP COUNTER
CTD – DOWN COUNTER
CTUD – UP DOWN COUNTER
Declaration of Input and Output of different Counter PLC blocks
Declaration of Input, Output, and Other blocks of CTU UP COUNTER PLC block
S. No | Operation | Input/Output/Others | Address of Each Block |
1 | Input Switch_01 | Input | %M0.0 |
2 | Input Switch for Counter block (Load Associated Coil) | Input | %Q0.0 |
3 | Count UP Block | UP Counter | %DB1 |
4 | Output Load for Input Switch | Output | %Q0.0 |
5 | Output Load of Counter Block | Output | %Q0.1 |
Declaration of Input, Output, and Other blocks of CTD DOWN COUNTER PLC block
S. No | Operation | Input/Output/Others | Address of Each Block |
1 | Input Switch_02 | Input | %M0.0 |
2 | Input Switch for Counter block (Load Associated Coil) | Input | %Q0.2 |
Input Switch for down Counter | Input | %M0.5 | |
Input for Down Counter | Output | %Q1.0 | |
3 | Count DOWN Block | DOWN Counter | %DB2 |
4 | Output Load for Input Switch | Output | %Q0.2 |
5 | Output Load of Counter Block | Output | %Q0.3 |
Declaration of Input, Output and Other blocks of CTUD UP DOWN COUNTER PLC block
S. No | Operation | Input/Output/Others | Address of Each Block |
1 | Input Switch for Up Count | Input | %M0.2 |
2 | Input Switch for Down Count | Input | %M0.3 |
3 | Down Counter Output Load Switch | Input | %M0.4 |
4 | Input Switch for UP Counter (Load Associated Coil) | Input | %Q0.4 |
5 | Input Switch for DOWN Counter (Load Associated Coil) | Input | %Q0.5 |
6 | Output for the UP Counter | UP Counter Output | %Q0.6 |
7 | Output for the DOWN Counter | DOWN Counter Output | %Q0.7 |
8 | Output Load for UP Counter Input Switch | Output | %Q0.4 |
9 | Output Load for DOWN Counter Input Switch | Output | %Q0.5 |
10 | Count DOWN Block | DOWN Counter | %DB3 |
Different Phases of PLC Ladder Logic of Counter Block Operation
The PLC program is created using Siemens’ TIA Portal V16 software. According to the above statement, Different PLC Counter Blocks are explained in the following Sections.
CTU – UP COUNTER
- The UP counter will be “Turned ON” when the required number of counters is reached. This will happen when the input switch of the UP counter i.e.,CU ON and OFF for the required number of times.
- Once the input switch %M0.0 is Turned ON. The output %Q0.0 will be ON; this helps the input switch %Q0.0 of the counter %DB1 ON.
- The number of times the counter input switches ON that much of time the counter will increase the count.
- Once the required counter value is reached by the counter %DB1. The counter %DB1 set and will switch ON the output load %Q0.1.
CTD – DOWN COUNTER
- The DOWN counter will be “Turned ON” when the counter reaches to Zero value from the initial set value. This will happen when the input switch of the DOWN counter i.e., CD ON and OFF for the required number of times.
- The LD of Down counter %DB1is Reset the CTD counter to the required value set in the Preset Value (PV) and Turns OFF the output load %Q0.3
- Once the input switch %M0.1 is Turned ON. The output %Q0.2 will be ON; this helps the input switch %Q0.2 of the counter %DB2 ON.
- The number of times the counter input switches ON that much of time the counter will decrease the count.
- Once the counter %DB2 reaches zero the counter. The counter %DB2 set and will switch ON the output load %Q0.3.
CTUD – UP DOWN COUNTER
- The UP-DOWN Counter will be “Turned ON” in two states. The output QD, or down counter output, will be ON if the counter value is zero. The Down Counter also turns OFF if the Counter value is greater than zero. The Up Counter will start counting. Once the Up counter reaches the required value the QU Tuned ON.
- Before the input switch %M0.2 Turned ON. The UP-DOWN Counter %DB3 counter value is zero. Therefore, the Down Counter output i.e., QD is enabled. This QD Turns ON the input switch %M0.4.
- Now, %M0.2 will be Switched ON. This will be Turned ON the %Q0.4.
- The %M0.2 will be Turned ON and OFF continuously until it reaches the counter value. Once the Counter value is reached. The Up Counter %Q0.6 output Turned ON.
- Similarly, %M0.2 Turned ON and OFF continuously, the %DB3 counter start decremented from the current value. Once it reaches Zero, the %Q0.6 output Turns ON. The process is continuous.
The steps for programming ladder logic using the SIEMENS TIA website is available in below link.
Note: Please see the above page for a thorough description of how to program ladder logic using the Siemens TIA Portal.
Simulation screenshots of different type of Counter blocks
CTU – UP COUNTER
- The simulation result shows the operation of the UP Counter.
- The %M0.0 is the Main switch to Turn ON the input switch %Q0.0 connected to the Counter %DB1.
- The below diagram shows the Main switch %M0.0 is Turned ON, due to this the Load switch %Q0.0 is Turned ON, which helps the input switch %Q0.0 connect to the counter Turn ON the counter Value.
- The Main Switch %M0.0 Turns ON and OFF up to the Preset Value (say PV= 5 in this article). Once the Counter %DB1 reaches the Present Value the Counter output %Q0.1 Turns ON.
CTD – DOWN COUNTER
The simulation shown below is the Operation of the Down Counter.
Here the Main Switch %M0.1 is used to Turn ON the input switch %Q0.2 connected to the Counter %DB2.
Once the simulation starts the output %Q0.3 will be in ON Stage. This is because if the CTD counter is Zero. The output %Q0.3 connected to the Down counter CTD %DB2 will be ON.
The output %Q0.3 connected to the Down counter CTD %DB2 will be OFF, only if the CTD %DB2 reaches the Preset Value. This is achieved by Turn ON the Input Switch %M0.5. This input Switches by Turning on the input switch %Q0.2 connected to the counter indirectly through the load Switch %Q0.2.
Once again, the CTD %DB2 Turns ON the output%Q0.3 connected to the counter by turning On the %M0.1 number of times until it reaches Zero.
CTUD – UP DOWN COUNTER
- The below simulation results show the UP-DOWN Counter Operation.
- The UP Down Counter operation is a combination of the above two Counter.
- The UP-DOWN counter %DB3 contains CU, CD, R, LD & PV Inputs.
- The simulation result has two operations i.e., when the counter reaches zero and when the counter reaches the required value. The first one is Count Down and the latter is Count Up
- Here %M0.2 is used for the Count UP operation and %M0.3 is used for the Count DOWN Operation (through the corresponding load Switch).
- The %Q0.4 and %Q0.5 are used as Count Up and Count Down input switches respectively.
- When the %Q0.4 is turned through the %M0.2 to the required operation the load Turned ON.
- Similarly, When the %Q0.5 is turned through the %M0.3 until it reaches zero the output load %Q0.6Turns OFF.
- At the same time the Down Counter Load %Q0.7 Turns ON due to Preset Value.
By doing the above exercise the reader can understand different types of counter logics used in a PLC Ladder Logic.