Lab Exercise 8 - PLC Counters
Lab Exercise 8 - PLC Counters
Submission profile
Results
70%
Report
Structure
30%
Total
Performance Objectives
After attending this lab the student will be able to:
Design the basic logic functions based on Counters
Tool:
1. Programmable Logic Controller (PLC) – S7 1200
2. Logosoft Comfort 8
Introduction
Counters Fundamentals
Siemens S7-1200 Counters are available in three different forms: count up (CTU), count down
(CTD), and count up and count down counter (CTUD). Table 1 shows the basic parameters for the
CTU, CTD, and CTUD. Operation of the three types of counters will be discussed in class. The
concepts covered in this section follows the Siemens notations but can be applied to other PLC
brands with minor modification
Activity 1
Count Up Counters (CTU)
The count up counter’s main function is to increment the current value each time the input to the
counter transitions from 0 to 1. If the current count value (CV) is equal to the preset value (PV), the
output Q is set. When reset input (R) is TRUE, the accumulated value resets to 0. Counter preset input
can be defined as a tag name or a constant value. The counter block is shown in Fig. 1 with
appropriate tag names assigned. These tags are displayed between double quotes in the figure. All
counter required variables are displayed using the standard system labels, which start with the percent
(%) character. Counter preset input can be defined as a tag name or a constant value. Figure 2
provides the timing diagram for this timer.
The START push button runs the motor immediately, which drives a conveyor system. Once the
conveyor system runs, an input is received from the motor magnetic starter indicating successful
system start (MOTOR_RUN). The motor runs for the duration to allow a preset number of parts
to be transported over the conveyor system, which is set to 100 in our case. When the motor running
input (MOTOR_RUN) is set, indicating that the conveyor is moving, a photoelectric cell will issue a
positive narrow pulse as a part crosses its beam, which causes the CTU current value (CV) to
increment.
Activity 2
Count Down Counters (CTD)
The countdown counter’s main function is to decrement the current value (CV) each time the input to
the counter transitions from 0 to 1. If the current value is equal to or less than 0, the counter output Q
is set. The value at the CV is set to the value of the PV parameter when the signal state at the LD
input changes to 1. As long as the LOAD input has signal state 1, the signal state at the CTD input
has no effect on the instruction. Figure 5 shows the CTD counter block, and Fig. 6 provides the
timing diagram. Figure 7 shows a ladder-logic diagram example for the CTD counter instruction.
The preceding example uses a motor to derive a conveyor system. The system requires that the
conveyor system shuts down once a preset value for rejected parts is reached. Part rejection is
initiated through a photoelectric inspection cell.
Figure10 shows a ladder-logic diagram for the CTUD counter instruction. It has four inputs (PE1,
PE2, RESET, and LOAD), two outputs (COUNT_UP and COUNT_DOWN), and two parameters
(COUN_CV and COUNT_PV).
Activity 4
PLC counter program used to stop a motor from running after 10 operations.
Activity 5
Can-counting program that uses three up-counters.
Counter C5:2 counts the total number of cans coming off an assembly line for final packaging.
Each package must contain 10 parts. When 10 cans are detected, counter C5:1 sets bit B3:0/1 to initiate the
box closing sequence. Counter C5:3 counts the total number of packages filled in a day. (The maximum
number of packages per day is 300.) • A pushbutton is used to restart the total part and package count from
zero daily.
Activity 6
Program that provides continuous monitoring of items in process.
Exercise
Q1 Set up the circuit of activity 1 figure 4 on S7 1200 PLC and attach it.
Q2 Set up the circuit of activity 2 Figure 7 on S7 1200 PLC and attach it.
Q3 Set up the circuit of Activity 3 on S7 1200 PLC figure 10 and attach it.
Q4 Set up the circuit of Activity 4 on S7 1200 PLC figure 10 and attach it.
Q5 Set up the circuit of Activity 5 on S7 1200 PLC figure 10 and attach it.
Q6. Set up the circuit of Activity 6 on S7 1200 PLC figure 10 and attach it.
Q7. Parking lot has two momentary action sensors to count the number of cars entering or exiting
the garage. One sensor is placed at the entrance, and the other is placed at the exit. Two
messages should be displayed to customers indicating the status of the parking lot (“Parking
is Full” or “Parking is Empty”). Parking full is simulated by PL1, and parking empty is
represented by PL2. Write and document a ladder-logic program to implement this process.
Q8. Draw ladder diagram for the following: Develop the ladder logic that will turn on a light,
after switch A has been closed 10 times. Push button B will reset the counters.
LD stands for “Load” which is used to load the value from which the down counter should
start, and decreases with each pulse.