 Hello everyone, welcome to this session on PLC counters part 1. At the end of the session you will be able to examine symbol basic usage and types of counters used in PLC programming. You will be able to write simple ladder run diagrams with counter for basic operations like counting objects on a curve conveyor belt etcetera. So, let us learn about the counters in more details. Counters which allows the number of occurrences of the input signal to be counted. Counters are predefined as standard function blocks in IEC 61131 part 3 standard. On the slide you will see a up counter symbol where you will see on the left hand side you have some inputs and on the right hand side you have some outputs. A counter is set to some preset value that is represented in integer when the preset value of the input pulses have been received it will operate it contact means normally open contact will close whereas normally closed contact will open. There are two approaches how you can use counter first approach counter can be considered as a combination of following basic elements a relay coil to count input pulses. So, here you will see CTD represents down counter relay coil whereas, CTU in another run shows you up counter relay coil. Second element is again a relay coil to reset the counter. So, here on the top of the ladder diagrams you will see relay coils are represented for a reset function. And the third element is a dependent contact and the associated contact of the counter being used in other runs. So, here at the end of each ladder diagram you will see contacts are shown these contacts gets activated whenever that counter function gets executed ok. So, in down counter this particular counter contact activated when 0 reached after counting down from the set value whereas, in up counter this particular contact will be activated when the set count reached after counting up from 0. Second approach counter can be considered as a intermediate block in a run from which signal Q originates when the count is attained. So, here you will see a switch is used through which the pulses are applied to this down counter. In the second ladder diagram you will see again one switch is used to apply input pulses to this up counter. Now, here output gets energized when the 0 is reached after counting from down from set value. So, this is regarding down counter. For the up counter output Q will be set when the set count is reached after counting up from 0. So, these are the two approaches you can use counter in your ladder diagram programming. There are three types of counter down counter up counter and up down counter. So, before going to learn these counters in detail let us understand more about the inputs of all these counters. So, here CD represents countdown. So, when the signal at this input changes from 0 to 1 the current value is decremented by 1. So, CD input is related to down counter. Then you have here C U. So, C U is a count up signal. So, whenever the signal at this particular pin changes from 0 to 1 the current value is incremented by 1. If you see the Boolean is the data type associated with these two inputs means you are expecting either 1 or 0 on these two input lines. Counter gets updated only on the rising edge of the pulses on these two inputs. Next input is the LD, LD stands for load when load input is true the CV value is set equal to PV and it clears Q to 0 and the load signal is associated with the down counter. Similarly R is again one more input R stands for reset when reset becomes true counter resets and clears CV as well as Q values to 0. Reset signal is associated with the up counter functionality of counters PV is the integer value indicates desired preset value CV is again another integer value indicates the counters current value Q U is the output of counter set to true when up counting is done that is when CV becomes PV and last Q D is the output set to true when down counting is done that is when CV becomes 0. Let us learn more about these counters in detail let us first start with the down counter down counter counts down from the preset value to 0 that is events or occurrences are subtracted from the preset value when the down counter reaches 0 its context changes its state. Here a small structure text code is shown which is equivalent to a down counter so here you will see if LD is true then CV is assigned with the PV value else when CD is true and CV is greater than PV value then CV is always decremented by one every time otherwise Q will be set. Let us understand the counter down counter with the help of this waveform so here at T 0 and T 1 you will see that load signal is true. So, current value CV is set to the preset value so here you will see that at T 0 CV value is set to 3 and at the same time Q resets to 0 counter decrements the current value each time the input to the counter transitions from 0 to 1. So, here at T 1 T 2 T 3 you will see that counter is decrementing every time at T 3 when the current value is equal to 0 the output Q is set. Let us learn about the up counter up counter counts from 0 up to the preset value that is events are added until the number of reaches the preset value when the counter reaches the preset value its contact changes its state. So, this is a waveform which you can use for understanding the behavior of up counter counter increments the current value each time the input to the counter transitions from 0 to 1. So, here at T 0 T 1 T 2 T 3 instant is you will see that counter is incrementing its CV value. So, 0 then 1 2 3 4 at T 4 when the current value is equal to the preset value Q resets to 0 at T 4 when reset input R is true the accumulated value associated with CV and Q resets to 0. Next is the up down counter with up down counter you can achieve the up as well as down counting function. If the signal state at the input count up that is C u transitions from 0 to 1 the current value increments. Whereas, if the signal state at the input countdown that is C d transitions from 0 to 1 then the current value decrements. So, here is the waveform which shows you the behavior of up down counter. So, here you will see that C u we have applied input pulses each time CV increments at C d input also we applied two inputs to pulses and the result of these two pulses you will see that counter value is decremented by 2 with the help of counter let us solve this example. Let us develop a ladder diagram for a system that will give an output after a photocell sensor has given 10 pulses input signals which is a result of detecting 10 objects passing in front of it. So, you can consider this photocell is placed on a conveyor belt and on a conveyor belt you will see objects are moving from one place to another one end to another end and the photocell sensor detects these objects and let us develop a ladder diagram with a counter to count these objects. So, here is the solution whenever there is a transitions from 0 to 1 at the input i n which is connected to reset the counter resets to 0. So, CV as well as Q value resets to 0. So, here this i n switch is used for reset purpose whereas, i n 2 input represents the output of photocell sensor. So, whenever there is a object detected by photocell sensor pulse is applied to input 2. So, here you will see 10 pulses are shown on this input 2 timeline after 10 pulses output becomes 1 means CV becomes PV CV value is equal to PV value which is 10. So, this is the summary whenever an object passes in front of photocell sensor input 2 gets activated each time. When there is an input 2 input 2 and a transition from 0 to 1 the counter starts counting every time. When 10 transitions from 0 to 1 have been received at input 2 the counter contact will close and there will be an output from output 1. These are the references which you can go for further reading. Thank you.