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