Upload
elaine-dichosa
View
216
Download
0
Embed Size (px)
Citation preview
7/27/2019 Exp.4 PLC Timers and Counters
1/5
Experiment 4: PLC Timer and Counter
Carpio, Joseph Reihart R., Group 1 EE113L/B6
November 3, 2011
Objectives
To make a program using Timer and Counter Functions To familiarize ourselves to the PLC Trainer
Theoretical Background
PLC MEMORY
Advanced ladder logic functions such as timers and counters allow controllers to perform calculations,
make decisions and do other complex tasks. They are more complex than basic input contacts and outputcoils and they rely upon data stored in the memory of the PLC. The memory of the PLC is organized to
hold different types of programs and data.
Ladder diagram programming allows PLCs to perform several different types of tasks, including Boolean
logic, timing, counting, arithmetic, and special functions. We'll discuss the basic instructions and function
block instructions, which are common to nearly all PLCs. In addition to these instructions, most PLCs
support many extended instructions to perform more complicated tasks.
Timing instructions
The basic timing instructions are on-delay and off-delay. With on-delay timers, the output associated withthe timing instruction is turned ON some specified time after the input is ON, but it turns OFF
immediately when the input is turned OFF.
With off-delay timers, the output is turned ON immediately when the input is turned ON. However, it
remains ON for a specified period of time after the input has been turned OFF, but before going OFF.
Timing instructions are usually connected like relay coil instructions in the ladder diagram, so any
combination of input conditions can be programmed to trigger them. When a timing instruction is created
in the PLC program, space is reserved for the timer running value and the preset value at which the timer
will trip, and the programmer must set the preset value to the desired number when inserting the
instruction. The status of the timer output can be checked with the examine instructions for use in otherrungs in the program.
Various combinations of on-delay and off-delay timers can be used to perform more complicated
functions like, for example, interval or cycle timing.
7/27/2019 Exp.4 PLC Timers and Counters
2/5
Counting instructions
The basic counting instructions provide for count-up, count-down, and counter reset functions. The
count-up instruction simply increases the value of a counter by 1 each time an upward (OFF to ON)
transition is detected in the input.
A count-down instruction does the opposite, decreasing the count value by 1 on each upward transition
of the input. When the value of the count reaches or exceeds a preset number, the output of a counter
instruction is turned ON.
The reset instruction resets the value of the count to 0 or to a predetermined reset value. A positive reset
value may be used, for example, for a down counter that is expected to count down to 0. As with timing
instructions, counting instructions are usually connected like relay coil instructions in the ladder diagram,
and space is reserved for the running count value and the preset trip value when the instruction is
created in the PLC program. Counter instructions usually have the additional feature in that they can be
referenced to the same address, so that the up, down, and reset actions can be performed on the same
counter if desired.
Arithmetic instructions
Almost all PLCs have simple ladder diagram instructions to add, subtract, multiply, and divide two
numbers. A ladder rung for an instruction used to perform an arithmetic operation typically has three
parts. First are the input conditions that must be true in order for the computation to take place; this can
be any combination of examine instructions. Second are the locations of the two numbers to be operated
upon; these locations are often entered into the ladder diagram as get instructions, which resemble
examine instructions and which tell the program where to find the numbers in memory. The third and
final part of an arithmetic ladder rung is the output location; it's usually entered as an address assigned
to the actual arithmetic instruction (+, -, x, or /), which resembles a relay coil instruction.
Each time the input conditions are met, the two numbers are retrieved from the input locations, the
indicated arithmetic operation is performed, and the result is put into the output location. Several
arithmetic instructions can be linked to perform more complex operations by assigning outputs from
previous rungs as inputs in subsequent rungs
Another group of arithmetic instructions are the compare instructions, which determine if one number is
less than, equal to, or greater than another number. They are programmed in the same way as the
arithmetic operations; each time the input conditions are met, the indicated comparison ([less than], =,
or [greater than]) is made. The output bit assigned to the instruction is turned ON if the comparison is
true.
Function block instructions
The basic ladder diagram instructions just described are fine for performing many simple tasks, but
sometimes things get more complicated. What if there's a need to program a shift register, stack, or
process controller, for example? Or perhaps there's a desire to configure a serial communication module
or a network connection. Although these complex tasks probably could be programmed with
7/27/2019 Exp.4 PLC Timers and Counters
3/5
combinations of the standard instructions, PLC manufacturers have introduced function blocks to make
programming some of the more common tasks easier.
Like an arithmetic rung, a rung that contains a function block has three parts. First are the input
conditions, which again consist of combinations of, examining instructions. There may be multiple input
conditions, however, because function block instructions often have several inputs. Then comes thefunction block itself, which may contain locations for many parameters that must be set to control its
action. Finally there are the outputs, which resemble relay coils, and which allow the function block to
interact with other rungs in the program.
Any given function block may have one or several outputs. Numerical outputs can be used by other rungs
as inputs to arithmetic instructions, and relay coil (bit) outputs can be examined with the examine
instructions.
Many PLC manufacturers have now converted timing, counting, and arithmetic instructions to the more
user-friendly function block format and the programming documentation available for a specific PLC will
explain the programming of the various available function block instructions in detail. Rung 6 in the Fig. 1ladder diagram program shows an example of a function block that is used to send data over a network.
Procedures
Prepare the materials to be needed in this experiment (CPM2A PLC Trainer, PC Workstation, RS232 cable,
mouse). Connect the PLC Trainer to the computer. Then follow each of the conditions stated:
Part 1: Timer Simulation
Given the sequence, design the ladder diagrama. Lamp 1 turns ON once the Start is pressed.b. After 2 seconds, Lamp 2 turns ON
c. After 3 seconds, Lamp 3 turns ONd. And after another 2 seconds, all lamps will turn OFF. Pressing Start again will repeat the sequence
Part 2: Counter SimulationIn a brewery plant
a. A momentary, NO contact pushbutton is used to select which kind of beer to produce.b. First ON selects Beer_1; Second ON selects Beer_2; Third ON selects Beer_3.c. Fourth ON shall reset selection (all outputs are reset)d. cycle continues depending of number of ONs on the pushbutton
Part 3: Timer and Counter SimulationTest A. Implement the process with the following specifications:
a. A start button (0.00, momentary, N.O. contact) shall be used to start the sequence. No two motors areturned ON at a given time.b. Motor 1 shall be turned ON once the start is pressed.c. After 2 seconds Motor 1 is turned OFF then Motor 2 is turned ON.d. After 2 seconds Motor 2 is turned off then Motor 3 is turned ON.e. After 2 seconds Motor 3 is turned OFFf. After 3 continuous cycles, the process resets. Pressing Start will begin the process again.
7/27/2019 Exp.4 PLC Timers and Counters
4/5
Test B. When START button is pressed, Lamp A blinks for (3) times (0.5 sec ON, 0.5 sec OFF pulse) and
after the counter reached the set count, Lamp A should turn OFF. Pressing START again will repeat thecycle.
Test C. A START/STOP circuit: If START is pressed, a cycle should operate continuously until STOP (1stpriority) is pressed. The cycle is that Lamp A blinks for three times (0.5 sec ON, and 0.5 sec OFF pulse)
and after the cycle there will be a 3 sec delay (Lamp A: OFF) before the cycle restarts again. PressingSTOP will turn OFF Lamp A and immediately and resets the cycle.
Part 4. APPLICATION
System and/or process alarms (disturbances should be handled properly to be able to simplify and tomake fast error detection in any given system. Implement an Alarm Handling program such that:a. When Alarm is triggered (0.00, PB), the Lamp (10.00, 24 V dc) will flash (0.5 sec ON and 0.5 sec OFF)so as to attract the operators attention.b. An Acknowledge pushbutton (0.01, momentary, NO contact) is used by the operator to let the systemknow that he/she is aware of the presence of an Alarm. Without pressing the Acknowledge, the Lamp willcontinue flashing to indicate the occurrence of the Alarm.c. If Acknowledge is pressed while the condition is still true, the Lamp will switch to a steady lamp. When
the Alarm is no longer present, the Lamp turns OFF.d. If Acknowledge is pressed after the occurrence of the Alarm, the Lamp turns OFF.
Results and Discussion
Two common PLC Timers are the ON Delay Timer and the Off Delay Timer. When a timer is
programmed into a PLC ladder diagram, a preset value must be entered. When the rung condition is true,
the timer begins the accumulator value to increment. When the accumulator value and the preset time is
equal, the timer stops timing and the primary output energizes. If the logic continuity of the rung is lost
before the timer has timed out, the accumulator value goes to zero. It will start again when the rung
becomes true. In an off delay timer, when the accumulator is equal to the preset value, the output goes
low and the accumulator resets to zero. if the continuity of the rung returns to a true condition before the
timer has timed out, the timer will stop counting and the accumulator value will reset to zero.
In programming a counter, there are some information to be inputted like the symbol and the
address. The symbol appears in the screen along with the abbreviation indicating which type of counter is
used. The address is an alphanumeric term which will indicate which counter is used and the preset
which indicates the number of counts that can be made to cause the counter to cause action. When the
preset is equal to the accumulated value, the primary output goes high.
7/27/2019 Exp.4 PLC Timers and Counters
5/5
Conclusion
Timers are output instructions that are internal to the programmable logic controller or PLC. They
provide timed control of the devices that they activate or de-activate. PLC Timers perform various actions
like delay certain actions, cause an operation to run a predetermined period of time and record
accumulated time of continuous or intermediate events.
A timer is activated by a change in the logic continuity of its rung. When there is continuity, the
rung condition is true otherwise, false. After the timed interval has expired , the timers primary output is
energized.
Counters are like timers that are output instruction that are internal to the programmable logic
controller. Counters simply count and store the number of events that occur. There are two type of
counters, up-counters and down-counter.
A latch is used to cause the rung to continue on its function even if the switch is not pressed.
References
http://www.wisc-online.com/objects/ViewObject.aspx?ID=IAU6107