You are on page 1of 18

Chapter 11

PLC Compare Jump,and MCR ,


Instructions
p Chapter Outline
11.1 Introduction
11.2 Compare Instructions
11.3 Unconditional Jump
11.4 Conditional Jump
11.5 Master Control Reset (MCR)
11.6 LogixPro Simulator Examples

p Technical Terms
compare instructions greater than (GRT) jump (JMP) instruction
equal to (EQU) less than or equal to (LEQ) master control reset (MCR)
not equal to (NEQ) greater than or equal to (GEQ) instruction
less than (LES)

Learning Objectives
After completing this chapter, you will be able to:
Use a compare instruction to energize a coil.
Program compare instructions in series to set upper and lower
limits in a control system.
Use the jump (JMP) instruction to skip over rungs in a PLC
ladder logic diagram.
Use multiple jump (JMP) instructions with multiple label (LBL)
instructions in a PLC ladder logic diagram.
Use compare instructions to energize the jump (JMP)
instructions.
Use a master control reset (MCR) instruction to halt the
operation of a section of a PLC ladder logic diagram.

11.1 Introduction
In control systems, sometimes certain conditions must be tested
to perform appropriate action. Compare instructions are used to test
these conditions.

243
244 Programmable Logic Controllers: Hardware and Programming

In Allen-Bradley SLC 500 series programmable logic controllers,


there are six compare instructions. The compare instructions are the
following:
• Equal to (EQU).
• Not equal to (NEQ).
• Less than (LES).
• Greater than (GRT).
• Less than or equal to (LEQ).
• Greater than or equal to (GEQ).
These compare instructions, either individually or in conjunction
with each other, can be used to check content of PLC registers. In this
chapter, you will learn how to use them.
When a PLC is scanning a ladder logic diagram, sometimes one
or more rungs should not be scanned. When a rung is not scanned,
the state of the instructions on the rung remains the same. The condi­
tion for skipping over rungs can be generated either by the state of
an input/contact or as the result of a compare instruction. The jump
instruction (JMP) in a PLし is used to skip over rungs and therefore not
execute their instructions. In this chapter, you will learn how to use
the JMP instructions in PLC ladder logic diagrams.
During emergency conditions, when the power source connected to a
section of the control system is removed, the operation of the PLC must be
halted. Yet, the power to the PLC needs to be maintained so that the ladder
logic diagram stays in the PLC RAM memory. When power is removed
from RAM memory, everything is lost. Therefore, PLC systems are usu­
ally connected to an Uninterruptible Power Supply (UPS). Thus, during
electric power losses the ladder logic program in the PLC memory is not
erased. However, during the power loss, the operation of the system must
be halted. The master control reset (MCR) instruction is used to stop the
operation of the PLC system. The MCR instruction is also used for safety
such as keeping moving parts from starting automatically when power is
restored. In this chapter, you will learn how to use the MCR instruction in
PLC laader logic diagrams.

11.2 Compare Instructions


Compare instructions: Compare instructions are PLC instructions used to compare
PしC instructions used numerical values. There are six basic PLC compare instructions. These
to compare numerical
values.
compare instructions are listed in Figure 11-1. Most PLC devices have
Equal to(EQ U):
these basic compare instructions. The Allen-Bradley SLC 500 series
Instruction that lets PLCs also have these six basic compare instructions. In this section,
current pass through you will learn how to use the compare instructions. You will also
when Source A is equal learn to program two compare instructions in series to set upper and
to Source B.
lower limits for the output.
Figure 11-2 displays the equal to (EQU) compare instruction.
Source A must be a register. Source B can be either a register or a
Chapter 11 PLC Compare, Jump, and MCR Instructions 245

number. With the equal to instruction, when the content of Source


A is equal to the content of Source B, the current will pass through
the EQU instruction block. In Figure 11-2, Source A and Source B are
registers. When the content of register N7:0 is equal to the content of
register N7:l, the pilot light (0:0/0) turns on.
Figure 11-3 displays the not equal to (NEQ) compare instruction. Not equal to (NEQ):
It is, as it sounds, the opposite of the equal to instruction. Source A must Instruction that lets
current pass through
be a register. Source B can be either a register or a number. With the when Source A is not
not equal to instruction, when the content of Source A is not equal to equal to Source B.

Equal to (EQU) A =B
Not equ a l to (NEQ) A 式 B
Less th a n (LES) A<B
G reater th a n (GRT) A>B
Less tha n or e qu a l to (LEQ) A<B
G reater th a n or equal to (GEQ) A>B

Figure 11-1. The six basic PLC compare instructions.

Pilot light
EQU-
0000 Equal O
Source A N7 :0
0<
Source B N7 :1
0<

nnm

Figure 11-2. The equal to (EQU) compare instruction.

Pilot light
NEQ-
0000 Not equal O
Source A N7 :0
0<
Source B N7 :1
0<

0001 c >
Figure 11-3. The not equal to (NEQ) compare instruction.
246 Programmable Logic Controllers: Hardware and Programming

the content of Source B, current will pass through the NEQ instruction
block. Therefore, in Figure 11-3, when the content of register N7:0 is not
equal to the content of register N7:l, the pilot light (0:0/0) turns on.
Less than (LES): Figure 11-4 displays the less than (LES) compare instruction.
Instruction that lets Source A must be a register. Source B can be either a register or a
current pass through
when Source A is less number. With the less than instruction, when the content of Source A
than Source B. is less than the content of Source B, current will pass through the LES
instruction block. Therefore, in Figure 11-4, when the content of regis­
ter N7:0 is less than the content of register N7:l, the pilot light (0:0/0)
turns on.
Greater than (GRT): Figure 11-5 displays the greater than (GRT) compare instruction,
Instruction that lets which does the opposite of the less than instruction. Source A must
current pass through
when Source A is greater be a register. Source B can be either a register or a number. When the
than Source B. content of Source A is greater than the content of Source B, current
will pass through the GRT instruction block. Therefore, in Figure 11-5,
when content of register N7:0 is greater than the content of register
Less than or equal N7:l, the pilot light (0:0/0) turns on.
to(LEQ): Figure 11-6 displays the less than or equal to (LEQ) compare
Instruction that lets
instruction. Source A must be a register. Source B can be either a
current pass through
when Source A is less register or a number. When the content of Source A is less than or
than or equal to Source B. equal to the content of Source B, current will pass through the LEQ

Pilot light
LES
0000 Less than (A<B) O
Source A N7:0
0<
Source B N7:l
0<

0001 End

Figure 11-4. The less than (LES) compare instruction.

Pilot light

Greater than (A>B) O


Source A N7:0
0<
Source B N7:l
0<

0001
< End.
Figure 11-5. The greater than (GRT) compare instruction.
Chapter 11 PLC Compare, Jump, and MCR Instructions 247

instruction block. Therefore, in Figure 11-6, when content of register


N7:0 is less than or equal to the content of register N7:l, the pilot
light (0:0/0) turns on.
Figure 11-7 displays the greater than or equal to (GEQ) com­ Greater than or
pare instruction. Source A must be a register. Source B can be either a equal to (GEQ):
Instruction that lets
register or a number. When the content of Source A is greater than or current pass through
equal to the content of Source B, current will pass through the GEQ when Source A is greater
instruction block. Therefore, in Figure 11-7, when content of register than or equal to Source B.
N7:0 is greater than or equal to the content of register N7:l, the pilot
light (0:0/0) turns on.
In some industrial applications, the condition being tested is
tested for bandwidth. This means that the compare instructions need
to test for an upper and a lower limit. For these types of applications,
two or more compare instructions are connected in series. Example 11-1
illustrates how to connect two compare instructions in series.

Example 11-1
In this example, the content of a counter-accumulated register is
tested. If the content is less than five, all pilot lights are off. If the con­
tent is between five and ten, the white pilot light (White_PLT) turns

Pilot light
LEQ ■
0000 Less than or equal (A<=B)
Source A N7 :0
o
0<
Source B N7:1
0<

0001 ( >

Figure 11-6. The less than or equal to (LEQ) compare instruction.

Pilot light
GEQ ■
0000 Greater than or equal (A>=B)
Source A N7:0
o
0<
Source B N7:1
0<

0001 ( >

Figure 11-7. The greater than or equal to (GEQ) compare instruction.


248 Programmable Logic Controllers: Hardware and Programming

on. If the content is equal to ten, the green pilot light (Green_PLT)
turns on. If the content is greater than ten, the red pilot light
(Red_PLT) turns on. Figure 11-8 displays the PLC ladder logic dia­
gram for this example.
Looking at rung 0001,a GEQ instruction is in series with an LES
instruction. The GEQ instruction requires a number greater than or
equal to five to allow the white pilot light (White一PLT) to trigger. The
LES instruction requires a number less than 10. Thus, in rung 0000,

Exam ple 11-1


Pushbutton
1:0
0000 Count up
Counter
<a
1
Preset 0<
Accum 3<

White_PLT
-------GEQ------- ----- LES---------
0001 Grtr than or eql(A>=B) Less than (A<B)
Source A C5:0.ACC Source A C5:0.ACC
o
3< 3<
Source B 5 Source B 10
5< 10く
Green PLT
------ EQU-------
0002 Equal
Source A C5:0.ACC O
3<
Source B 10
10く
Red_PLT
-------GRT-------
0003 Greater than (A>B)
Source A C5:0.ACC O
3<
Source B 10
10く
C5:0 C5:0
0004 — (^RES^)-

Switch

0
0005 < End>

Figure 11-8. PLC ladder logic diagram for Example 11-1.


Chapter 11 PLC Compare, Jump, and MCR Instructions 249

if the pushbutton (1:0/1) is pressed between five and nine times, the
condition for the compare instructions in series in rung 0001 is met
and the white pilot light (White一PLT) turns on.
The compare instructions in rungs 0002 and 0003 test the condi­
tions for equal to (EQU) and greater than (GRT). When the pusnbut-
ton is pressed 20 times, the reset (RES) instruction in rung 0004 is
energized and the counter resets to zero. Closing the switch (1:0/0)
can also reset the counter.

I 113 Unconditional Jump


The jump (JMP) instruction in a PLC is used to skip over rungs. Jump (JMP) instruction:
Therefore, when the jump instruction is used, the PLC will not execute When current flows
through the JMP
the instructions of a rung that is jumped. The jump (JMP) instruction instruction (i.e., JMP
is always assigned a number. Also, the jump instruction must have is energized) rungs
a label instruction (LBL) with the same assigned number. If a ladder between the JMP and its
similarly addressed LBL
logic diagram has several jump instructions, each jump instruction will not be scanned.
must have a label instruction with a matching number. The jump
instruction and its associated LBL must have the same addresses. Q2:0
through Q2:255 are the addresses used for the jump (JMP) instruc­
tions. Therefore, you can have up to 256 jumps and their pertaining
label functions in a PLC ladder logic diagram.
Figure 11-9 illustrates the use of the jump instruction in a PLC
ladder logic diagram. Notice in the diagram, this jump instruction is

Pushbutton Green PLT

0000 ヨ O

Switch
-E

0 001

Pushbutton Red PLT

0002 ヨ O

Q 2:l B3:0
0003 [ lbl} < >

0004 End

Figure 11-9. T h e ju m p (J M P ) in s tru c tio n fo r th e A lle n -B ra d le y S L C 5 0 0 PLC.


250 Programmable Logic Controllers: Hardware and Programming

activated when the switch (1:0/0) is closed. When the switch (1:0/0) is
open, pressing the pushbutton (1:0/1) turns both pilot lights on. How­
ever, if the switch is closed, the jump (JMP) instruction will activate.
In Figure 11-9, the jump and label instructions are assigned to have
address number one (Q2:l).
When the switch is closed, the JMP instruction is energized.
Now, pressing the pushbutton only turns on the green pilot light
(Green_PLT). Rung 0002 is skipped over during the PLC program
scan. Notice that the label instruction (LBL) must always be connected
in series with an output or internal coil bit. This is because every rung
in a ladder logic diagram must have an output or internal coil for the
last instruction. In rung 0003, you can see that the LBL instruction is
connected in series with internal coil bit B3:0/0.
The jump instruction is a very useful tool. The jump instruction
in PLC ladder logic diagrams is used to formulate the if-then-else pro­
gramming code capability.

|11_4 Conditional Jump


In Section 11.3, you learned how to activate a jump (JMP) instruc­
tion by closing a switch. By combining the jump instructions with the
compare instructions you studied in Section 11.2, you can create con­
ditional jump instructions. This means that when a specific condition
(or conditions) is met, the jump instruction will be activated. Example
11-2 illustrates how to use compare and jump instructions in a PLC
ladder logic diagram.

Example 11-2
In this example, the content of a counter-accumulated register
(C5:0.ACC) is tested. If the content is less than five, closing switch
(1:0/0) turns on both pilot lights. If the content is equal to five, then
closing the switch will only turn on the red pilot light (Red_PLT). If
the content is greater than seven, then closing the switch will only
turn on the green pilot light (Green_PLT). Figure 11-10 displays the
PLC ladder logic diagram for Example 11-2.
Pressing the green pushbutton increments the content of the
accumulator register for counter zero (C5:0.ACC). When the content
of the accumulated register is equal to five, closing the switch will
not turn on the green pilot light. When the content of the accumu­
lated register is greater than seven, closing the switch will not turn
on the red pilot light. Pressing the red pushbutton (Red_PB) resets
the counter.

The conditional jump instruction can be used in many areas. One


common area for this instruction is in process control for packaging
and sorting. For example, soft drink bottles are passing down a line.
Chapter 11 PLC Compare, Jump, and MCR Instructions 251

Example -2
Green_PB

0000

------- EQU--------
0001 Equal
Source A C5:0.ACC
2<
Source B 5
5<

Switch
1:0
0002
0
Q2:l B3:0
0003 _ £ lb l] -------------------

-------GRT------- Q2 ::
0004 Greater than (A>B)
Source A C5:0.ACC
2<
Source B 7
7<

Switch Red

oフ
oc
ェ:〇
0005
0
B3:0
0006 £ lbl> <>
1

Red一PB
1:0 C5:0
0007 〈 RES>
2

0008 End

Figure 11 -10. PLC ladder logic diagram for Example 11-2.

When the packaging machine counts out 12 bottles, the bottles need to
be placed in a cardboard container. So, after a count of 12, the machine
does a conditional jump to a packaging routine.
252 Programmable Logic Controllers: Hardware and Programming

111.5 Master Control Reset (MCR)


Master control reset The m aster control reset (MCR) instruction is used to stop the
(MCR) instruction: operation of the control system during a high-voltage power outage
When current stops
flowing through the MCR to the control system. Notice that during the power outage, the PLC
instruction (i.e., MCR Is will still be energized either by the on-board battery or the UPS sys­
de-energized), outputs tem. There are two major differences between the MCR and the JMP
on the rungs between
the two MCR instructions instructions.
will turn off. 1 . The JMP instruction must be energized to be activated. The MCR
instruction must be de-energized to be activated. Therefore,
the MCR instruction is usually connected to a normally closed
switch.
2. When the JMP instruction is activated, the instructions on the
rungs between the JMP and LBL instructions are skipped over.
This means that the output between JMP and LBL instructions
retain their previous status. When MCR is activated, the
instructions between the MCR instructions are turned off.
The MCR instruction is usually connected to the control power
switch. This is so that in case of power failure, the control system shuts
down. Example 11-3 illustrates how to use the MCR instruction in a
PLC ladder logic diagram.

Example 11-3
Figure 11-11 displays the PLC ladder logic diagram for the Exam­
ple 11-3. Closing the normally open switch turns on both pilot lights.
If you press the normally closed red pushbutton (Red_PB), the MCR
instruction activates. Then, both pilot lights turn off.

Exam ple 11-3


Red_PB
1:0
0000 :
R>
2
Switch en
_E o

1:0
0001 B-
0
Switch
1:0
0002 -9 E-
0

0003 (MCR>

Figure 11-11. PLC ladder logic diagram for Example 11-3.


Chapter 11 PLC Compare, Jump, and MCR Instructions 253

Therefore, when the MCR coil is de-energized, the rungs between


the two MCR instructions turn off. Notice that when the outputs were
skipped due to energized jump instructions, they retained their pre­
vious states. However, when the MCR instruction is de-energized, the
outputs turn off. Note that when MCR is de-energized, then the instruc­
tions between the two MCR lines will turn off. Hence, the MCR instruc­
tion on the top rung is usually connected to a normally closed input.

6 LogixPro Simulator Examples

Example 11-4
The ladder logic diagram in Figure 11-12 shows various compare
functions. The content of the accumulated register for the counter
address at C5:0 is tested in the various compare function blocks against
the content of the accumulated register for the counter address at C5:l.
The function blocks are in rungs 002 through 009. If a compare function's
condition is correct, its output is energized. Rungs 010 and 011 demon­
strate how compare function blocks can be placed in parallel or series to
further specify the criteria and limit inputs that will energize an output.

Example 11-4
PLC Compare Functions (chapter 11)
1/0 CTU •
Count Up
-PB Counter C5:0
Preset 1000
Accum 0
1/1 CTU •
Count Up
-P B Counter C5:l
Preset 1000
Accum 0
EQU--------
Equal
Source C5:0.ACC E q u a l To
7
Source B 3

(Continued)
Figure 11-12. PLC ladder logic diagram for Example 11-4. Programming compare functions in
LogixPro the simulator.
254 Programmable Logic Controllers: Hardware and Programming

NEQ-------- 0 :2/1
003 Not Equal
Source C5:0.ACC Not Equal To
?
Source B 4
?
■LES 0 :2/2
004 Less Than (A<B)
Source C5:0.ACC Less Than
?
Source B 6

■GRT _ 0:2/3
005 Greater Than (A>B)
Source C5:0.ACC Greater Than
?
Source B ?
?
■LEQ ■ 0:2/4
006 Less Than or Eql
Source C5:0.ACC Less Than or Equal To
?
Source B 9

•GEQ ■ 0:2/5
007 GTR Than or Eql
Source C5:0.ACC Greater Than or Equal To
?
Source B 12

■LIM - 0 :2/6
008 Limit Test
Low L 14 Between Upper and Lower Limit
7>
Test C5:0 ACC
?
High Ijim 16

-MEQ _ 0:2/7
009 Masked Equal
Source C5 :0 ACC Equal To with Mask
?
Mask 3
?
Compare 3

Figure 11-12. Continued.


Chapter 11 PLC Compare, Jump, and MCR Instructions 255

EQU _ 0 :2/8
010 Equal
Source C5:0.ACC Corrpare Functions in Parallel
7
Source B 20
•p

■EQU •
Equal
Source C5:1.ACC

Source B 10

---- GRT--------- ---- NEQ--------- 0:2/9


Oil Greater Than (A>B) Not Equal
Source C 5 :0.ACC Source C 5 :0.ACC Compare Functions in Series
? ?
Source B 22 Source B 25
•p 7

C5:0
-a e -(res )-
Reset
C5:l
-(RES)-

Figure 11-12. Continued.

Example 11-5
The ladder logic diagram in Figure 11-13 shows jump and master
control relay functions. Jump functions have addresses Q2:0 through
Q2:255. Each jump function must have a corresponding label function
with a matching address. This is illustrated twice in Figure 11-13, one two
jump function and its label sharing address Q2:0 in rungs 003 and 005
and a second jump function and label with corresponding address Q2:l
in rungs 006 and 008. The ladder rungs between a jump function and its
label are skipped when the jump function is energized. When an output
is jumped, it retains its last state. For example, when the jump function
Q2:0 is energized, rung 004 is skipped. In this case, output Y-LT at address
0:2/0 will retain its last state. If it is energized, it will remain energized.
The master control relay (MCR) function is used to turn off the
outputs in a ladder logic diagram or a section of ladder logic diagram.
While an MCR function is energized, it is activated, and the rungs
between its two functions operate normally. However, if an MCR func­
tion is de-energized, the rungs between the two MCR functions are all
256 Programmable Logic Controllers: Hardware and Programming

Exam ple 11-5


PLC Janp and MCR Functions.
1/u ---- CTU —
r
000 し Count Up <O
' T
>
PB Counter C5:0
Preset 1000
Accum 0
1 :1 / 1 CTU -
001
Count Up
R-PB Counter C5:l
Preset 1000
Accum 0

You must de-energize the MCR to turn OFF the rungs between the two MCR functions.
1:1/4
002 VMCR^
MCR—SW

You must energize the JMP function to activate it. Jump Q2:0 has the Label Q2:0.
1 :1/2 Q2:0
003 -Q mp)-
SW1

GRT • 0 :2/0
004 Greater Than (A>B)
Source C5:0.ACC Y-LT
7
Source B 3
2

0
: B3:0/0
^ >
005 L
B

You mast energize the JMP function to activate it. Jump Q2:l has the Label Q2:l.
1:1/3 Q2:l
006 -]E - <JMP>
SW2
2

0 : /1
y
>

GEQ----------
007 Grtr Than or Eql
G

Source C5:1.ACC LT
-
L
?
Source B 5
?

(Continued)
Figure 11-13. PLC ladder logic diagram for Example 11-5. Programming jum p and master control relay
functions in the LogixPro simulator.
Chapter 11 PLC Compare, Jump, and MCR Instructions 257

008

009

010

Oil

Figure 11-13. Continued.

de-energized. For example, if the master control function in rung 002


is de-energized, outputs between rungs 002 and 009 are turned off. If
their outputs were energized, they become de-energized. The states of
the outputs in the rungs between two MCR functions are not retained
when an MCR function is de-energized.

■ Summary
• There are six basic compare instructions: equal to (EQU), not
equal to (NEQ), less than (LES), greater than (GRT), less than or
equal to (LEQ), and greater than or equal to (GEQ).
• There are two program control instructions: jump (JMP) and
master control reset (MCR).
• Compare instructions can be programmed in series to set upper
and lower limits in a control system.
• For the equal to (EQU), not equal to (NEQ), less than (LES),
greater than (GRT), less than or equal to (LEQ), and greater than
or equal to (GEQ) instructions, Source A must be a register, but
Source B can be either a register or a number.

example for each compare instruction in a ladder logic diagram.


2. Use the basic PLC compare instructions to create a PLC ladder
logic diagram for testing the condition for less than ten and
greater than or equal to five.
258 Programmable Logic Controllers: Hardware and Programming

3. Use the basic PLC compare instructions to create a PLC ladder


logic diagram for testing the condition for less than twelve, but
not equal to nine.
4. In a GEQ instruction, when Source A is equal to Source B, can
current flow through the GEQ instruction block?
5. Can you connect two or more compare instructions in series? If
the answer is yes, provide an example.
6. In the LES instruction, can both Source A and Source B be numbers?
7. In the LEQ instruction, when Source A is equal to Source B, can
current flow through the LEQ instruction block?
8. In the EQU instruction, can both Source A and Source B be
registers?
9. How do you activate the jump (JMP) instruction?
10. How do you activate the master control reset (MCR) instruction?
1 1 . What happens to the state of instructions in the rungs that are
jumped over?
12. When the MCR instruction is activated, what happens
to instructions on the rungs that are between the MCR
instructions?
13. When do you use the MCR instruction?

Complete each o f the following sentences with the correct word(s).

14. In an EQU instruction, Source A and Source B can both b e .


15. In an EQU instruction, one source may be a(n) while the
other source is a register.
16. In an EQU instruction, when the content of Source A i s _____
the content of Source B, the current will flow through the EQU
instruction block.
17. In a GRT instruction, when content of Source A i s ______ the
content of Source B, the current can pass through the GRT
instruction block.
18. In a GEQ instruction, when content of Source A i s ______ the
content of Source B, the current can pass through the GEQ
instruction block.
19. In GRT and GEQ instructions, both Source A and Source B can
be •
20. In GRT and GEQ instructions, both Source A and Source B
cannot b e .
2 1 . Each JMP instruction must have a(n) instruction.
22. A jump instruction (JMP Q2:l) is associated with the label
instruction .
23. When a rung is skipped over, the state of its I/O instructions
Chapter 11 PLC Compare, Jump, and MCR Instructions 259

24. The rung with a LBL instruction must have an output


instruction or a(n ) .
25. You m ust the JMP instruction to activate it.
26. When the MCR instruction is de-energized, the PLC control
system tu rn s .
27. The instructions in the rungs between two MCR instructions
tu rn whenever the MCR instruction is energized.
28. The jump instruction must b e to cause a jump, while the
MCR coil must b e ______to activate the MCR instruction.
29. When rungs are de-energized by MCR instructions, their
outputs are turned .

Specify if the following statements are true or false.

30. You must energize a JMP coil to activate the JMP instruction.
3 1 . You must energize a MCR coil to activate the MCR instruction.
32. The states of the instructions that are jumped over remain the
same.
33. When the MCR instruction is de-energized, the state of the
instructions that are between the MCR instructions remain the
same.
34. In a GEQ instruction, when Source A is equal to Source B, the
current can flow through the GEQ instruction block.
35. In a GEQ instruction, when Source A is greater than Source B,
the current can flow through the GEQ instruction block.
36. Two compare instructions can be connected in series.
37. In a GRT instruction, Source A and Source B can both be registers.
38. In a GRT instruction, Source A and Source B can both be numbers.

Using the JM P and M C R instructions, draw the PLC ladder logic diagram
fo r the following problems.

39. Draw the PLC ladder logic diagram that calculates the sum of
two counter-accumulator registers. Place the sum in the preset
register of the third counter. If the sum is equal to 15 or 20, turn
the red pilot light (Red_PLT) ON. If the accumulator register for
counter number two is equal to 13, turn the light OFF. Make sure
to include a reset switch for the counters.
40. Draw the PLC ladder logic diagram that calculates the difference
of two counter-accumulator registers. Place the difference in a
temporary integer register. If the difference is greater than 10 but
not equal to 13, turn the green pilot light (Green_PLT) ON. If the
accumulator register for counter number two is equal to 4,
turn the light OFF. Make sure to include a reset switch for the
counters.
Programmable Logic Controllers: Hardware and Programming

4 1 . Implement the following equation on your PLC simulator.

R i 一 尺 2

where, ァ1 一'
Ri is the resistance value for temperature ta.
R2 is the resistance value for temperature t2.
T\ is temperature in degree Kelvin, 7^ = h + 273.
T2 is temperature in degree Kelvin, T2 = t2 + 273.
Assume that three counters provide the variables labeled Rv tx,
and t2. Your PLC program should calculate R2.
If R2 is greater than 100 ohms, turn the red light on. If R2 is less
than or equal to 100 ohms, turn the green light on.
42. Write a PLC program to implement the following equation.
R = px(L/A)
where,
R represents the resistance value of a wire,
p represents the resistance constant value of the wire
material.
L is the length of the wire.
A is the cross-sectional area of the wire.
Assume that the variables p, L, and A are in registers N7:0, N7:l,
and N7:2 respectively.
Your PLC program should calculate R. If R is greater than 47
ohms, turn the red pilot light on. If R is equal to 47 ohms, turn
the green pilot light on. If R is less than 47 ohms, turn the yellow
pilot light on.

You might also like