Ch6 - Intermediate Programming Application
Ch6 - Intermediate Programming Application
APPLICATIONS
Intermediate Programming Application
We will learn about some other PLC
instruction such as:
Move (MOV)
Compare (CMP)
Interlocking (IL and ILC)
Shift Register (SFT)
Differentiate Up (DIFU)
Differentiate Down (DIFD)
Some of this are very useful for analog input
purposes
Memory
Before we learn about these
instructions, it is better to have a
sufficient knowledge about the PLC’s
memories
Any instruction/operation in PLC can
be monitored to/from their memory
PLC’s memory is divided into several
area
We can attempt to write/modify any
of these memory areas, however, BE
CAREFUL as some modification will
resort in malfunction of an operation
Memory
Most of the instruction that we have learn before
only revolve around the CIO area
CIO is the memory area where all the possible input
and output addresses and their contents are located
The CIO memory area can be manually written and
monitored at the same time in online mode
As the Omron CJ2M-CPU11 contained a 16-bit
microcontroller inside, all of its memory is also in 16-
bit form, which are usually represented as 4-digit
hexadecimal number (commonly use in ladder
diagram)
Lets examine some of our previous exercises in terms
of the memories that they have occupied
MOV Instruction
MOV instruction is an instruction to copy and
paste a content (source) from word or memory to
another memory (destination)
Push Push
Start Stop
button button
PB4 PB3 RL BL YL PL GL CL
0 0 ON ON OFF OFF OFF OFF
0 1 ON OFF ON OFF ON OFF
1 0 OFF ON OFF ON OFF ON
1 1 OFF OFF OFF OFF ON ON
Exercise 19
The ladder
diagram:
Is it hard and a bit confusing to determine
which pushbutton are pressed/released or
which light are turn ON/OFF?
This is because we usually see the input and
output as components
Now, by using MOV instruction and monitoring
the CIO area memory, we need to think the
input and output as a binary data (just like in
microprocessor class)
As for that, the previous Exercise 19 can be
better understood if we write the truth table in
address sorting
Did you notice that we have done an if/else
condition in Exercise 19?
This is one way of implementing an if/else
condition on a ladder diagram
The better way of doing an if/else condition is
by combining a CMP (compare) and MOV
instruction together
CMP Instruction
Compares two unsigned binary values (from a manually
inserted word or/and content of an address) and outputs
the result to the Arithmetic Flags in the Auxiliary Area