To make things easier for you, I am going to start an article on the counter with a simple example. If you do like this then I will be going to write more article on Analog and Digital both types of programming with the help of instructions.
In this article, you will learn counter in STL language with the help of Siemens Simatic Manager.
Counters are used where to count infeed product or to count existing product, etc. is required.
There are three types of the counter available in Simatic manager,
1. CU (Up counter)
2. CD (Down counter)
3. CUD (Up-Down counter)
Those who have worked with ladder logic knows addressing in Siemens software. The same addressing used in STL language.
Here, I will take an example of a down counter with a reset coil to reset the counter.
As I am using down counter, I have to use preset value to start count from that preset value in down order. In our example, I will use 20 as a preset value.
In the below window you can see STL programming of the down counter.
On the right-hand side, you can see ladder logic of down counter. I have included this to make things clear in STL.
In the first three lines of code, I have used A (ANDing) of set input than for down counter I have taken a preset value of 20. Then this value is set to counter number zero (C0). This first three lines of code are used to represent a counter.
In the next three lines of code, I have used A (ANDing) to add two input and as per down counter, notation CD is used.
To start from the preset value, I have used reset instruction to start it from a preset value.
You can replace CU for the UP counter and CUD for the up-down counter, everything else will remain the same.
You can do programming in LD and STL together to learn and understand in a quick manner.
Hope you like this new article on PLC programming. If you do like this article then do comment down below and keep share it amongst your friends.