IPC Lab 10
IPC Lab 10
IPC Lab 10
EXERCISE OBJECTIVE
• To program and test PLC ladder programs that use comparison instructions.
DISCUSSION
PLC’s have special input instructions that are used to perform comparison
functions. For example, the PLC on your trainer includes the following comparison
instructions:
• Equal (EQU);
• Not Equal (NEQ);
• Less Than (LES);
• Less Than or Equal (LEQ);
• Greater Than (GRT);
• Greater Than or Equal (GEQ).
Each of these instructions compares a pair of arithmetical values. The result of the
comparison determines whether the comparison instruction is true or false.
Suppose, for example, that a GEQ instruction is presented with two values. If the
first value is greater than the second, then the GEQ instruction is logically true.
This causes the rung containing the GEQ instruction to be true, making the
output instruction on this rung true.
With the trainer PLC, the following parameters must be programmed when
entering a comparison instruction:
This instruction determines whether the values at Sources A and B are equal. If
so, the EQU instruction is true. If not, the EQU instruction is false.
Comparison Instructions
This instruction determines whether the values at Sources A and B are not equal.
If so, the NEQ instruction is true. If not, the NEQ instruction is false.
This instruction determines whether the value at Source A is less than the value at
Source B. If so, the LES instruction is true. If not, the LES instruction is false.
This instruction determines whether the value at Source A is less than or equal to
the value at Source B. If so, the LEQ instruction is true. If not, the LEQ instruction
is false.
This instruction determines whether the value at Source A is greater than the
value at Source B. If so, the GRT instruction is true. If not, the GRT instruction is
false.
Procedure Summary
In this exercise, you will program and test three ladder programs: one that uses
an Equal (EQU) instruction, one that uses comparison instructions driven by the
accumulated value of a counter instruction, and one that uses comparison
instructions driven by the accumulated value of a timer instruction. You will then
use the acquired knowledge to create and test your own ladder program.
8-3
• Model 3240-A, Model 3240-D, or Model 3240-3: Same way as with
Model 3240-4.
EQUIPMENT REQUIRED
PROCEDURE
G 3. In this exercise, you will study the operation of PLC instructions through
observation of the ladder program view, the data files of the processor,
as well as the status of the lamps next to the PLC output jacks on the
trainer front panel.
The project tree of processor EXERC_8 and program file LAD 2 should
be displayed in the RSLogix Micro window. Program file LAD 2 contains
the main ladder program.
The next steps of this procedure consist in entering the ladder program
of Figure 8-1.
Enter a new rung into program file LAD 2. In this rung, enter
instruction XIC I:0/0. Then, enter instruction CTU C5:0.
You have now finished entering the instructions of rung 0 in the ladder
program of Figure 8-1.
Enter a new rung into program file LAD 2. In this rung, enter an
EQU instruction by performing the following steps:
8-4
– Click the Equal button on the instruction toolbar to insert this
instruction in the rung, type: C5:0.ACC, then press the mouse left
button to enter this address for Source A of the EQU instruction. This
address is that of the word containing the accumulated value of
instruction CTU C5:0.
– Double-click Source B within the EQU instruction, type: 5, then
press the mouse left button to accept this constant.
– This completes the parameter setting for the EQU instruction.
Select the User category of instructions and enter instruction OTE O:0/0.
You have now finished entering the instructions of rung 1 in the ladder
program of Figure 8-1.
G 7. Enter a new rung into program file LAD 2. In this rung, enter instruction
XIC I:0/1. Then, enter instruction RES C5:0.
You have now finished entering the instructions of rung 2 in the ladder
program of Figure 8-1.
G 8. Using the Verify Rung command, verify the rungs that have been edited.
Correct any errors.
G 12. In rung 1 of program file LAD 2, locate the EQU instruction. The
accumulated value of instruction CTU C5:0, which is currently 0, is
indicated below the address specified for Source A.
Activate and deactivate PLC input 0, using one of the toggle switches of
the trainer, until the accumulated value of instruction CTU C5:0 in rung 0
reaches 5.
Is PLC output 0 activated, indicating that the EQU instruction in
rung 1 is true? Why?
Yes, the PLC output 0 is lit because the value of source A is equal to the value of
source B in the EQU instruction.
No, the PLC output is 0 is OFF because the value of source A is not equal to the
value of Source B.
G 14. Reset instruction CTU C5:0. To do so, activate PLC input 1, using another
toggle switch of the trainer. What happens to the accumulated value of
instruction CTU C5:0, as indicated within this instruction and below the
address specified for Source A of the EQU instruction? Explain.
Activation of PLC input 1 resets the counter which causes the accumulated value in
both counter and EQU instruction to go to ‘0’.
G 15. On the PLC Trainer, make sure that all PLC inputs are deactivated
(remove all the switch connection leads and place all the switch toggles
downward).
G 17. Modify the existing main ladder program of project EXERC_8 as indicated
below in order to obtain the ladder program shown in Figure 8-2:
c. Insert a new rung below rung 1. In the newly created rung (rung 2),
enter a Greater Than or Equal (GEQ) instruction having the
address: C5:0.ACC for Source A and the constant: 9 for Source B.
d. Insert a new rung below rung 2. In the newly created rung (rung 3),
enter a Not Equal (NEQ) instruction having the address: C5:0.ACC
for Source A and the constant: 13 for Source B.
Using the Verify Rung command, verify the rungs that have been edited.
Correct any errors.
G 18. Using the Save As command in the File menu, save the new main ladder
program in a project file named EXERC_8a.RSS.
G 19. Download project EXERC_8a to the PLC of the PLC Trainer. Go online
and place the PLC in the Run mode.
G 20. Observe that the accumulated value of instruction CTU C5:0, which is
currently 0, is indicated below the address specified for Source A within
all the comparison instructions (GRT, LEQ, GEQ, LES, and NEQ
instructions).
Is PLC output 2 activated, indicating that the NEQ instruction in
rung 3 is true? Why?
G 21. Activate and deactivate PLC input 0 several times, using one of the toggle
switches of the trainer, until the accumulated value of instruction CTU
C5:0 reaches 6.
Is PLC output 0 activated, indicating that the GRT and LEQ instructions in
rung 1 are both true? Why?
GRT instruction is true in rung 1 because the value of source A is greater than
that of source B and LEQ instruction is true because value of source A is less than
that of source B. So output 0 is activated.
G 22. Deactivate and activate PLC input 0 until the accumulated value of
instruction CTU C5:0 reaches 9. What happens to PLC output 0 when
the accumulated value reaches 9? Why?
The PLC output 0 turns OFF when the accumulated value of turns to 9
because the LEQ instruction in rung 1 becomes false i.e. Source A is greater
than Source B.
As the accumulated value of counter reaches 12, the PLC output 1 turns ON
because the NEQ instruction in rung 3 is true.
G 24. Deactivate and then activate PLC input 0 so that the accumulated value
of instruction CTU C5:0 reaches 13. What happens to PLC output 2
when the accumulated value reaches 13? Why?
The PLC output 2 turns OFF because the NEQ instruction in the rung 3 becomes
false.
G 25. Deactivate and then activate PLC input 0 so that the accumulated value
of instruction CTU C5:0 reaches 14. What happens to PLC output 2
when the accumulated value reaches 14? Why?
When the accumulated value reaches 14 the NEQ instruction in the rung 3 turns ON
which causes the PLC output 2 to turn ON as well.
G 26. Reset CTU instruction C5:0. To do so, activate PLC input 1, using another
toggle switch of the trainer. What happens to the accumulated value
of instruction CTU C5:0, as indicated within this instruction and
below the address specified for Source A of the comparison
instructions? Explain.
As the PLC input 1 is activated, the accumulated value of counter, as indicated within
the CTU instruction and the address specified for Source A of the comparison
instructions turns to zero.
G 27. On the PLC Trainer, make sure that all PLC inputs are deactivated
(remove all the switch connection leads and place all the switch toggles
downward).
G 29. Modify the existing main ladder program of project EXERC_8a as indicated
below in order to obtain the ladder program shown in Figure 8-3:
– Double-click Timer, type: T4:0, then press the mouse left button
to accept this address.
– Double-click Time Base, select 0.01 s in the drop-down list that
appears, then press the mouse left button to accept this
selection.
– Double-click Preset, type: 1500, then press the mouse left
button to accept this value.
– Leave the Accumulated value set to 0.
Using the Verify Rung command, verify the rungs that have been edited.
Correct any errors.
G 30. Using the Save As command in the File menu, save the new main ladder
program in a project file named EXERC_8b.RSS.
G 31. Download project EXERC_8b to the PLC of the PLC Trainer. Go online
and place the PLC in the Run mode.
G 32. Observe that the accumulated value of instruction TON T4:0, which is
currently 0, is indicated below the address specified for Source A within
all the comparison instructions (GRT, LEQ, GEQ, LES, and NEQ
instructions).
Is PLC output 2 activated, indicating that the NEQ instruction in rung
3 is true? Why?
Yes, the PLC output 2 is activated as the NEQ instruction in the rung 3
is true. This happens because the value of source A i.e. accumulated value, is
not equal to value of source B.
G 33. Activate PLC input 0, using one of the toggle switches of the trainer, and
observe that PLC outputs 0 through 2 are activated according to the
following time-driven sequence:
RUNG 0:
Activates timer when input 0 is activated.
RUNG 1:
Output 0 is activated when accumulated value is between 500 and 800.
RUNG 2:
Output 1 is activated when the accumulated value is between 900 and 1200.
RUNG 3:
Output 2 is activated all the time except when the accumulated value becomes
equal to 1300.
G 34. On the PLC Trainer, make sure that all PLC inputs are deactivated
(remove all the switch connection leads and set all the switch toggles
downward).
G 35. Place the PLC in the Program mode. Go offline and close project
EXERC_8b.RSS.
CONCLUSION
In this exercise, you became familiar with the comparison instructions of the
trainer PLC: the EQU, NEQ, LES, LEQ, GRT, and GEQ instructions. You saw
that these instructions compare a pair of arithmetical values, and that the result of
the comparison determines whether the comparison instruction is true or false.
You saw that the two values to be compared are located at Sources A and B.
Source A is a word address programmed when entering the comparison
instruction. Similarly, Source B can be a constant or a word address programmed
when entering the comparison instruction.
REVIEW QUESTIONS
2. With the trainer PLC, what two parameters must be programmed when
entering a comparison instruction? What do these parameters
represent?
With the trainer PLC, the following two parameters must be programmed
3. True or false? The LEQ instruction of the trainer PLC is true when the
value at Source B of this instruction is greater than or equal to the
value at Source A of this instruction.
FALSE. It is true when the value at Source A of this instruction is less than or
equal to the value at Source B of this instruction.
4. True or false? The NEQ instruction of the trainer PLC is true when the
value at Source A is greater than the value at Source B, and false when
these values are equal.
FALSE. It is true when the value at Source A is not equal to the value at Source Band
false when these value become equal.
The PLC comparison instructions can be used in conjunction with counter or timer instructions to
sequentially activate and deactivate PLC outputs. With this type of ladder program, a comparison
instruction is driven by the accumulated value of a counter or timer instruction. The comparison
instruction is activated when the accumulated value is equal, not equal, greater than, or less than a
constant, depending on the comparison performed.