Hello. 1
In this video we are going to learn timers and counters. 2
We are using timers and counters a lot of times in our plc projects in the left side. 3
You can see normal timer instruction and also ATMR and the totalizing timer examples are in 4
here. 5
So what is the difference between them timer contact t 0 becomes high after 5 seconds and I can draw 6
it in here. 7
We can use this timer contact in our plc project with a timer. 8
You can get directly output after your timer and totalizing timer. 9
You can see how many times past after timer is activated and in the right side you can see detailed 10
information for timer one hundred ms is default value of timers which timers t 0 2 the one 11
under twenty six so one hundred twenty seven point means you can use 127 different timer and also one 12
under twenty eight to one at 8 three fifty six point more you can use with one under millisecond timer 13
but if you activate M one thousand twenty eight contact or actually relay if you make this high so timer 14
64 and timer 126. 15
So from timer 64 till and also you can use it. 16
You can use t126. 17
This timers will be 10 milliseconds timer and t252, timer 255 so you can use 18
six point six different timer as accumulative timer. 19
If you want to use timer just directly or default 10 milliseconds you need to use T200 20
-T239 so 40 different point, forty different timer that you can use 21
as default timer as 10 milliseconds if you activate M one thousand thirty eight two high. 22
So timer two hundred to timer two hundred forty five. 23
So totally forty six timer will be one ms timer and also you can use one millisecond timer 24
as default timer one hundred twenty seven just one point that you can use as one millisecond timer. 25
If you look to counters in here you can use. 26
You can see ,CNT, counter example after counter value becomes 20 or equal to 20. 27
This counter will be high which counter Contact C15 contact will be high and DCNT. 28
So we are using DCNT as 32 bit high speed counter up or down or up and down counter. 29
So in here you can see C0-C111 30
These are general counters. 31
If you want to use C112 between C 127 counters these are latched counters remained counter after 32
plc's power is off or power is gone. 33
And after you opened or gave a power to plc this counters keeps last values inside of it. 34
But if you use general counter after power on your plc you are going to see C0 counters value as 35
zero or C50 becomes zero. 36
And if you want to use high speed counters you need to use C 235 to C 254 counters and in this value in 37
this range you can use high speed counters but we are going to look these counters detail early in the 38
next videos just for a moment. 39
We are focusing to general counters if we want to use high speed counters or if you want to high speed 40
count. 41
So you need to use DCNT command counter volume increase according to physical inputs so x 0 x 1 42
and 2 and 3 input pulses according to these Pulses. 43
This counter is going to count a value or pulses when trigger signal goes from off to on counter value 44
increase. 45
And if Start contact condition before D contact remain always on counter value never increase. 46
So in here applicable software 47
High speed counters you can see in here in this table and applicable hardware high speed 48
counters you can see them all in this table. 49
Like I said we are going to look these counters detailly in the next videos. 50
We will learn encoder and encoder applications. 51
And in this between these applications or after these applications and basics we are going to learn 52
how to count our input pulses but which pulses ,high speed pulses. 53
We are going to count them all and we are going to make some applications to learn them all effectively. 54
So let us just to show an example timer and 55
counter and new project are created and the programs and new and timer we need to put 56
it like this. 57
Okay and let's start first of all give an example. 58
Timer LD M0 and timer T0. 59
Three second 60
LD M1 and in here a timer and t 1. 61
let's give an example to 62
And in here out m 2 and give an example to totalizing. 63
Timer T T M R and . 64
Give an example to it D 0. 65
We will read the totalizing timer value the inside of the D 0 and M is going to be 0 and put here 66
condition LD M3 and I will give you a clock pulse ld M1012 so 50 milliseconds on 67
and 50 milliseconds off. 68
But this is not okay because I will write here , not up. 69
I will use it ,just to up to give just one pulse to counter our counter will be C0 70
and the count value is going to be let's say five but one more condition. 71
m4 72
So let's sent this project to our simulator or our plc and transfer our project. 73
And yes now our project is transferring to simulator. 74
Okay. 75
Okay. 76
And plc is confirmed and create one device monitor then monitor table is okay and D0 we will follow 77
D0 value. 78
And in here is take a look once what will happen first M zero is activated after three seconds two and 79
three timer T Zero is activated so online. 80
edit and I am activated it. 81
Okay. 82
And I will 83
not in here just like this. 84
I not want to use it like this now. 85
Okay. 86
And one contact two here and I will use timer contact T Zero and Y0 and make this off and make 87
these off and send our online EDIT Okay program is updated ,update completed. 88
Okay. 89
M 0 on after 3 second why. 90
Zero is activated. 91
You can see it again. 92
Set on what happened set off you see timer value becomes zero again. 93
Set on its counting. 94
Imagine set of suddenly timer value is zero. 95
And condition is high again. 96
After three seconds why zero is activated. 97
So let's take a look to a timer set on after two seconds and two is activated. 98
So set off and set on it similar. 99
It is not. 100
becomes high. 101
Always before condition is. 102
Or on or off. 103
if a condition before a timer is on and our timer becomes high so the output is high or all timer 104
contacts high but the condition of timer is goes off just like this. 105
So you can see it our timer goes off or becomes zero. 106
So imagine I want to use timer zero as TEN millisecond timer so how can I do this. 107
And I will come here and I will ld m1000 and out I will activate M one thousand twenty eight 108
value and switching on. 109
Okay. 110
Button this ten millisecond timer just . 111
The range was timer 64 and timer one hundred twenty six. 112
So I will put here my timer. 113
But first l the M5 just to close it and . 114
Timer sixty four will be one under millisecond time or for a moment. 115
Let's just change it to timer 64 and send them all to plc and update the program line and update is 116
completed now. 117
Okay you can see it set of 1 and 2 and 3 and output is high. 118
Okay let's activate our end one thousand twenty eight contact said sorry. 119
Set off. 120
Not this one. 121
This one set it on. 122
Okay. 123
1 so you can see it. 124
It is not working as 100 millisecond time and now it is working as tiny millisecond timer. 125
So again after zero point three seconds this contact will be high and set on and one before I'm saying 126
one it is becomes high so we can change our timer structure from 100 milliseconds to 10 milliseconds 127
or from ten millisecond to one millisecond. 128
With this contacts and also I will change it. 129
one thousand thirty eight and I will close it again and I will use t two hundred and again to 130
two hundred and what will happen for example now I will write here three hundred and I will send these 131
changes to our plc and update the program line. 132
I will set of these and I will watch what will happen now if I activate m 0 1 and 2 and 3 because T. 133
Two hundred equals telling me the second time in a second multiply by 300. 134
So this means three second after three second y zero becomes high again. 135
Let's take a look set on 1 and 2 and 3. 136
So what will happen if I activate and 5 contact and one thousand thirty eight contact becomes high. 137
So I will wait. 138
This time will be zero point three seconds and set on and 1 so you can see it zero point three seconds 139
later. 140
So that means after 300 millisecond i.e. zero becomes high. 141
So this is the usage of the timer. 142
This is how this is that we can learn how to use our timer contact in here and how to activate the ocular 143
relays and change our timer structure 100 milliseconds or 10 milliseconds or one millisecond an etc. 144
so that we used ATMR and we saw M2 contact become high. 145
So let's take a look once the totalizing in timer now set on. 146
So look D0 is increasing because N is zero, zero means was second eleven and 12 and 13 and 147
14. 148
We can use it. 149
We can just take a look at it here. 150
So let's change it to it. 151
Let's give a value to here the one and I will update our project. 152
no it is not allowing these data type is not matching. 153
So I will change it to 1. 154
Okay. 155
It will be a value as integer and update our program line. 156
So look now 48,49,50,51,52 sec. and 157
etc. 158
So now it is running as 100 millisecond. 159
So multiply this one hundred millisecond and we will get for a moment for example 70 71 and 72. 160
And what will happen if we want to monitor our value as a milliseconds. 161
A lot of more or with 162
this value to increase this value with the ten milliseconds. 163
I will change it to two and let's look what will happen and program is updated an update is completed. 164
So look now that now ten thousand , thousand three and four and five. 165
But if we divide this value to one hundred and we will get one hundred and eleven one hundred and thirteen 166
and one hundred and fifteen seconds passed. 167
So after two seconds two minute passed 168
After we activated this timer so we can monitor a time with like this. 169
So let's take a look once to our counter and I will use our counter contact in here. 170
I will click this ,How can I edit I cannot like this. 171
Okay. 172
And one more contact to here if it is possible 173
yes. 174
I will 175
do one more contact two here. 176
Okay. 177
Insert the network and LD C0. 178
And out. 179
Y2 180
Y2 181
And go on line again and send project to the PLC and now it's transferring to the plc 182
yes. 183
And run situation to our plc. 184
Okay. 185
Activate M4 and you can see after 5 pulse. 186
Suddenly my output y 2 becomes high. 187
This set of this but c 0 still 5. 188
So what we need we need to reset this counter. 189
How can we reset this counter go online edit and put an extra auxiliary relay to here M10 and reset 190
c 0 and then change this to this one and change this to 20 and update our program. 191
Okay update the program line and update is completed. 192
Good. 193
So now I will activate and 4 but set off again why I need to reset our counter set on so my counter 194
is resetted now and set off M4 is activated now. 195
So let's take a look. 196
My counter is counting to up according to our pulses each one second it is increasing one and after 197
9 second it will be completed and my C0 contact will be high. 198
It is focus here and now you can see C zero is high and we have an output so clear again or reset again. 199
our counter is resetted and now it's counting. 200
What will happen if I reset our counter always you can see it is always zero. 201
Just one pulse that I want to reset our counter. 202
I will put it to here and I will update my project again update the program line and update is completed. 203
So set of my counter is increasing I will set on this and just once it will reset and anymore. 204
It is not effect our counter. 205
So this is just one part. 206
It is allowing to power flow to the pass to right side 207
Just one pulse or as one pulse. 208
So now we learned how to use counter how to use timer have to use our counters and timers contacts and 209
a timer and total rising timer for the high speed counters. 210
We are going to focus them all in the next videos. 211
So for video I'm finished. 212
See you in the next video.