Counter: Siemens
Counter: Siemens
COUNTER
SIEMENS
SIMATIC S7
SIEMENS LTD EGYPT 2007 All Rights Reserved
1/11
SIEMENS
Objectives
- Know How Counter Works -How To Use Comparison Operation With Counter.
SIMATIC S7
SIEMENS LTD EGYPT 2007 All Rights Reserved
2/11
SIEMENS
Counter
Count Up Count Down Set Counter Preset Value Reset Counter
LAD Diagram
I 0.0
CU I 0.1 CD I 0.2 S C#50 I 0.3 R PV
C0 S_CUD Q Q CV CV_BCD
Q 0.0
MW 0
C0 S_CUD I 0.0 CU CD S PV R A CU A CD A L S A R L T A = CV CV_BCD Q Q I0.0 C0 I0.1 C0 I0.2 C#50 C0 I0.3 C0 C0 MW4 C0 Q0.0 Q 0.0 = MW 0
CV/CV_BCD Output
FBD Diagram
STL
SIMATIC S7
SIEMENS LTD EGYPT 2007 All Rights Reserved
3/11
SIEMENS
Comparison Operations
I0.0
CMP ==I
Q 0.0
You can use comparison instructions LAD Diagram to compare numerical values:
MW0
I D R
MW2
IN1 IN2
CMP ==I
The values at inputs IN1 and IN2 are compared FBD Diagram == IN1 is equal to IN2 <> IN1 is not equal to IN2 > IN1 is greater than IN2 < IN1 is less than IN2 >= IN1 is greater than or equal to IN2 <= IN1 is less than or equal to IN2.
MW0 MW2
Q0.0 =
STL
Q0.0
SIMATIC S7
SIEMENS LTD EGYPT 2007 All Rights Reserved
4/11
SIEMENS
Exercise:
1- Write a PLC program to control the counting between zero & 9,
0 9 9 0
SIMATIC S7
SIEMENS LTD EGYPT 2007 All Rights Reserved
5/11
SIEMENS
Answer of Exercise 1:
SIMATIC S7
SIEMENS LTD EGYPT 2007 All Rights Reserved
6/11