Académique Documents
Professionnel Documents
Culture Documents
LD
NOT IN1
AND IN2
STO OUT1
ENTER
ENTER
ENTER
As stated above, different PLC's may use different commands to perform some functions.
For instance, the Mitsubishi PLC uses the command LDI (LD INVERSE) instead of LD
NOT. This requires a single keystroke instead of two keystrokes to input the same
command.
If the normally closed contact had been IN2 instead of IN1, the command lines would
have to be modified as follows:
LD
IN1
AND NOT IN2
STO OUT1
ENTER
ENTER
ENTER
If using the Mitsubishi PLC, the AND NOT command would be replaced with the ANI (AND
INVERSE) command.
5-5.
OR Ladder Rung
Now, let us translate the ladder of Figure 5-3 into machine code.
5-4
Simple Branches
Now consider the ladder diagram of Figure 5-4, a more complicated AND-OR-AND
logic containing two branches.
(5-1)
This configuration of logic in Figure 5-4 utilizes four contacts, IN1, IN2, IN3 and IN4
controlling an output coil OUT1. As discussed in earlier chapters, coil OUT1 will energize
when (IN1 AND IN2) OR (IN3 AND IN4) is true. The first line (IN1 AND IN2) is entered in
the same manner as described in the previous examples:
(the 1. and 2. are line numbers for our reference only)
1.
2.
LD
IN1
AND IN2
ENTER
ENTER
For the next line (IN3 AND IN4) we must start a new branch. This is accomplished through
the use of another LD statement and a portion of PLC memory called the stack.
As program commands for a rung are entered into the PLC they go into what we will
call an active memory area. There is another memory area set aside for temporarily storing
portions of the commands being input. This area is called the Stack. Each time and LD
command is input, the controller transfers all logic currently in the active area to the Stack.
When the first LD command of the rung is input, there is nothing in the active area to
transfer to the stack. The next two lines of code would be as follows:
3.
4.
LD
IN3
AND IN4
ENTER
ENTER
The LD command for IN3 causes the previous two lines of code (lines 1 and 2) to
be transferred to the Stack. After lines 3 and 4 have been input, lines 1 and 2 will be in the
stack and lines 3 and 4 will be in the active memory area.
The two areas, active and the stack, may now be OR'ed with each other using the
command OR LD. This tells the controller to retrieve the commands from the stack and OR
that code with what is in the active area. The resulting expression is left in the active area.
This line of code would be input as shown below:
5.
OR
LD
ENTER
Up to now, most controllers would have recognized the same type of commands
(AND, OR). The LD and OR LD commands will, however appear differently in various
controllers depending upon how the manufacturer wishes to design the controller. For
instance, the Allen Bradley SLC-100 handles branches using branch open and branch
5-6