You are on page 1of 4

Siemens S7-1200

CPU 1212C AC/DC/Relay

Counter Operations (CTU)


• Count Up

www.codeandcompile.com
• Exercise Example

Code and Compile


Learning Made Easy
www.codeandcompile.com
Counter Operations in LAD – CTU (Count Up)
Count Up The "count up" counter (CTU) counts up by 1
when the value of the input parameter CU
changes from 0 to 1.

Data Block Data block Name

Input Signal Output Signal = 1


if CV >= PV

www.codeandcompile.com
Reset Count
Preset Count Current Count Value

Example If Preset Count = 3

The number of counters that you can


use in your user program is limited only
by the amount of memory in the CPU.
Individual counters use 3 bytes (for SInt
or USInt), 6 bytes (for Int or UInt), or 12
bytes (for DInt or UDInt).
Exercise Example
Write a Logic to latch the output Q0.0 using I0.0. Unlatch the output if I0.1 goes
from (0 – 1) 10 times (counts). Use I0.2 to reset the counter
Ladder Solution
PLC Wiring

X10

X11
1 2 3 4 5 6 7 8 9 10 11 12 13 14 1 2 3

L1 N L+ M 1M 2M 0 1

0.0
0.1
0.2
0.3
0.4
0.5
0.6
0.7
120-240 24VDC Analog
24VDC Inputs

www.codeandcompile.com
VAC Inputs

SIEMENS
SIMATIC
S7-1200 Relay Outputs

X1 P1 1L 2L

0.0
0.1
0.2
0.3

0.4
0.5
X12
1 2 3 4 5 6 7 8

Profinet (LAN)
Ethernet Port
M1

FBD Solution
What did we learn in this lesson?

 Counter are used to generate the output on


specific count of input
 If the value of parameter CV (current count
value) is greater than or equal to the value of
parameter PV (preset count value), then the
counter output parameter Q = 1.

www.codeandcompile.com
 If the value of the reset parameter R changes
from 0 to 1, then CV is reset to 0.

Thank you
Get copy of this presentation
in the course!

Code and Compile


Learning Made Easy
www.codeandcompile.com

You might also like