4/4/2017 PLC Program to Change Preset Value of Counter According to Various Products - Sanfoundry
PLC Program to Change Preset Value of Counter According to
Various Products
This is a PLC Program to Change Preset Value of Counter According to Various Products.
Problem Description
Different objects are moving on a conveyor belt. Let’s say, circular balls, square blocks and rectangular
blocks. All three types of objects are collected in the same sized box. As these types are different in size
and shapes as well, number of objects to be placed are different for each type. Set counter value
according to different sized objects’ detection. Implement automation of this in PLC using Ladder
Diagram programming language.
Problem Diagram
Diagram showing counting process of different objects
Problem Solution
Use three different proximity switches to detect all three different objects.
Mount these switches such that switches detect assigned object only. For example, mount Square
detector proximity such that it neither detects Rectangular blocks nor Balls.
Load counter values in registers for different objects. And load this value as soon as a particular type
of object is detected.
PLC Program
Here is PLC program to Change Preset Value of Counter According to Various Products, along with
program explanation and run time test cases.
http://www.sanfoundry.com/plc-program-change-preset-value-counter-according-various-products/ 1/4
4/4/2017 PLC Program to Change Preset Value of Counter According to Various Products - Sanfoundry
List of Inputs and Outputs
I:1/14 = Start (Input)
I:1/15 = Stop (Input)
O:2/0 = Master Coil (Output)
O:2/1 = Conveyor motor (Output)
I:1/0 = Square block detector (Proximity) (Input)
I:1/1 = Ball detector Proximity (Input)
I:1/2 = Rectangle block detector Proximity (Input)
MOV = To move corresponding source value to counter preset (Logical)
CTU = Up Counter to count the number of objects (Counter)
-(RES)- = To reset counter accumulator value (Reset)
Ladder Diagram to vary counter preset value
http://www.sanfoundry.com/plc-program-change-preset-value-counter-according-various-products/ 2/4
4/4/2017 PLC Program to Change Preset Value of Counter According to Various Products - Sanfoundry
Program Description
RUNG001 is to run conveyor motor when the process starts.
RUNG002 is to Move and Vary preset value of counter whenever a particular type of object is
detected.
When I:1/0 goes high, a square is detected, box has a capacity to pack 15 square blocks, hence #15
http://www.sanfoundry.com/plc-program-change-preset-value-counter-according-various-products/ 3/4
is moved to the preset value of counter with address C5:0.PRE. Similarly the same box has capacity to
4/4/2017 PLC Program to Change Preset Value of Counter According to Various Products - Sanfoundry
fill 20 balls or 10 rectangular blocks.
When C5:0 is done counting and C5:0.PRE = C5:0.ACC, C5:0/DN goes high momentarily which resets
counter immediately for next counting operation.
C5:0/DN bit can be used to take further actions such as moving filled box and packing it.
Runtime Test Cases
Inputs Outputs Physical elements
I:1/14 = 1 O:2/0 = O:2/1 = 1 Start conveyor motor
I:1/0 = 1 C5:0.PRE = 15 Collect 15 square objects
I:1/1 = 1 C5:0.PRE = 20 Collect 20 balls
I:1/2 = 1 C5:0.PRE = 10 Collect 10 rectangular blocks
http://www.sanfoundry.com/plc-program-change-preset-value-counter-according-various-products/ 4/4