
66
FERENTIATE DOWN, and KEEP instructions. All of these instructions ap-
pear as the last instruction in an instruction line and take a bit address for an
operand.These instructions (except for OUTPUT and OUTPUT NOT, which
have already been introduced) are introduced here because of their impor-
tance in most programs. Although these instructions are used to turn ON and
OFF output bits (i.e., to send or stop output signals to external devices), they
are also used to control the status of work bits and other bits in memory.
3-6-3
DIFFERENTIATE UP and DIFFERENTIATE DOWN
DIFFERENTIATE UP and DIFFERENTIATE DOWN instructions are used to
turn the operand bit ON for one scan at a time. The DIFFERENTIATE UP
instruction turns ON the operand bit for one scan after the execution condi-
tion for it goes from OFF to ON; the DIFFERENTIATE DOWN instruction
turns ON the operand bit for one scan after the execution condition for it goes
from ON to OFF. Both of these instructions require only one line of mnemonic
code.
0000
0001
DIFU(10) 0200
DIFD(11) 0201
Address
Instruction
Operands
000
LD
0000
001
DIFU(10)
0200
Address
Instruction
Operands
000
LD
0001
001
DIFD(11)
0201
Here, bit 0200 will be turned ON for one scan after bit 0000 goes ON. The
next time DIFU(10) 0200 is executed, bit 0200 will be turned OFF, regardless
of the status of bit 0000. With the DIFFERENTIATE DOWN instruction, bit
0201 will be turned ON for one scan after bit 0001 goes OFF (bit 0201 will be
kept OFF until then), and will be turned OFF the next time DIFD(11) 0201 is
executed.
Up to a total of 16 DIFFERENTIATE UP and DIFFERENTIATE DOWN in-
struction can be used in a program.
3-6-4 KEEP
The KEEP instruction is used to maintain the status of the operand bit based
on two execution conditions. To do this, the KEEP instruction is connected to
two instruction lines. When the execution condition at the end of the first in-
struction line is ON, the operand bit of the KEEP instruction is turned ON.
When the execution condition at the end of the second instruction line is ON,
the operand bit of the KEEP instruction is turned OFF. (If both execution con-
ditions are ON, the operand bit is also turned OFF.) The operand bit for the
KEEP instruction will maintain its ON or OFF status even if it is located in an
interlocked section of the diagram.
In the following example, DR 0000 will be turned ON when bit 0002 is ON
and bit 0003 is OFF. DR 0000 will then remain ON until either bit 0004 or bit
0005 turns ON. With KEEP, as with all instructions requiring more than one
Advanced Programming
Section 3-6