Lab4 COUNTER
Lab4 COUNTER
LAB 4: COUNTER
I. OBJECTIVES
Understand the counter types of PLC s7-1200
Apply the knowledge to several examples and experiments
II. INTRODUCTION
Counters are provided as built-in elements in PLC. Counters compare an accumulated value to
a preset value to control circuit functions. Control applications that commonly use counters
include the following:
Count to a preset value and cause an event to occur
Cause an event to occur until the count reaches a preset value
There are 3 main counters:
1. CTU (Counter Up)
2. CTD (Counter Down)
3. CTUD (Counter Up and Down)
Counters are represented by boxes in ladder logic. Counters increment/decrement one point
each time the input transitions from off (logic 0) to on (logic 1). The counters are reset when a
RESET instruction is executed. In Siemens, counters are depicted as
a) b) c)
Figure 1. a) Counter up, b) Counter Up/Down, c) Counter Down
Further information of the three counters are summarized in the table below
The counter status is shown through the Q output. The signal state at the Q output is
determined by the PV parameter. If the current counter value is greater than or equal to the
value of the PV parameter, the Q output is set to signal state "1". In all other cases, the Q
output has signal state "0". The value at the CV output is reset to zero when the signal state at
input R changes to "1". As long as the R input has signal state "1", the signal state at the CU
input has no effect on the instruction.
The counter status can be shown through the Q output. If the current counter value is less than
or equal to zero, the Q output is set to signal state "1". In all other cases, the Q output has
signal state "0". The value at the CV output is set to the value of the PV parameter when the
signal state at the Load input changes to "1". As long as the Load input has signal state "1",
the signal state at the CD input has no effect on the instruction.
The counter value can be incremented until it reaches the high limit of the data type specified
at the CV output. When the high limit is reached, the counter value is no longer incremented
on a positive signal edge. The counter value is no longer decremented once the low limit of the
specified data type has been reached. When the signal state at the Load input changes to "1",
the counter value at the CV output is set to the value of the PV parameter. As long as the Load
input has signal state "1", the signal state at the CU and CD inputs has no effect on the
instruction. The counter value is set to zero when the signal state at the R input changes to "1".
As long as the R input has signal state "1", a change in the signal state of the CU, CD and
Load inputs has no effect on the "Count up and down" instruction.
The status of the up counter can be shown at the QU output. If the current counter value is
greater than or equal to the value of the PV parameter, the QU output is set to signal state "1".
In all other cases, the QU output has signal state "0". On the other hand, the status of the down
counter can be found at the QD output. If the current counter value is less than or equal to zero,
the QD output is set to signal state "1". In all other cases, the QD output has signal state "0".
Write down the operation of the above circuit. Verify the results using the LEDs or alternative
outputs. Draw the logic waveforms at CU, R, Q, CV. Demonstrate it to the instructor.
Ans:
Write down the operation of the above circuit. Verify the results using the LEDs or alternative
outputs. Draw the logic waveforms at CU, LD(LOAD), Q, CV. Demonstrate it to the
instructor.
Ans:
Write down the operation of the above circuit. Verify the results using the LEDs or alternative
outputs. Draw the logic waveforms at CU, CD, R, LD (LOAD), QU, QD, CV. Demonstrate it
to the instructor.
Ans:
IV. Experiments
Experiment 1. Package Counter
A conveyor belt operated by a motor M is used to transport the products. The product is packed
inside a blank box whose maximum capacity is 10 products/box. The box will be moved along
the belt until it is full of 10 products. The conveyor belt is stopped and the operator will put
into a new blank box. The belt continues working after the operator presses the button S1.
The procedure keeps repeating and is stopped when a button S0 is pressed. Known that before
the product is packed inside the box, it needs to pass through a light sensor S2. Write a LAD
algorithm to describe the operation of the package counter.
Write a LAD algorithm to the above system. Verify your results and show to the instructor.
When pressing START, motor K1 rotates. As a result, liquid A firstly flows into a tank in
approximately 5s (S1 is detected) and liquid B will come next in line until the tank is full
(sensor S2 is detected). If the tank is full, motor K3 will rotate to mix the two liquids together
in 10s. After 10s, the valve K4 is opened to transfer all mixed liquid in the tank to another tank
completely. A whole procedure repeats and it is only stopped in emergency case when pressing
STOP button.
Write a LAD algorithm to the above system. Verify your results and show to the instructor.