Architecture of specific PLC controller
4.1 Why OMRON?
4.2 CPM1A PLC controller
4.3 PLC controller input lines
4.4 PLC controller output lines
4.5 How PLC controller works
4.6 CPM1A PLC controller memory map
4.7 Timers and counters
This book could deal with a general overview of some supposed PLC
controller. Author has had an opportunity to look over plenty of books
published up till now, and this approach is not the most suitable to the
purposes of this book in his opinion. Idea of this book is to work through
one specific PLC controller where someone can get a real feeling on this
subject and its weight. Our desire was to write a book based on whose
reading you can earn some money. After all, money is the end goal of every
4.1 Why OMRON?
Why not? It is a huge company which has high quality and by our standards
inexpensive controllers. Today we can say almost with surety that PLC
controllers by manufacturers round the world are excellent devices, and
altogether similar. Nevertheless, for specific application we need to know
specific information about a PLC controller being used. Therefore, the
choice fell on OMRON company and its PLC of micro class CPM1A. Adjective
"micro" itself implies the smallest models from the viewpoint of a number of
attached lines or possible options. Still, this PLC controller is ideal for
the purposes of this book, and that is to introduce a PLC controller
philosophy to its readers.
4.2 CPM1A PLC controller
Each PLC is basically a microcontroller system (CPU of PLC controller is
based on one of the microcontrollers, and in more recent times on one of the
PC processors) with peripherals that can be digital inputs, digital outputs
or relays as in our case. However, this is not an "ordinary" microcontroller
system. Large teams have worked on it, and a checkup of its function has
been performed in real world under all possible circumstances. Software
itself is entirely different from assemblers used thus far, such as BASIC or
C. This specialized software is called "ladder" (name came about by an
association of program's configuration which resembles a ladder, and from
the way program is written out).
Specific look of CPM1A PLC controller can be seen in the following picture.
On the upper surface, there are 4 LED indicators and a connection port with
an RS232 module which is interface to a PC computer. Aside from this, screw
terminals and light indicators of activity of each input or output are
visible on upper and lower sides. Screw terminals serve to manually connect
to a real system. Hookups L1 and L2 serve as supply which is 220V~ in this
case. PLC controllers that work on power grid voltage usually have a source
of direct supply of 24 VDC for supplying sensors and such (with a CPM1A
source of direct supply is found on the bottom left hand side and is
represented with two screw terminals. Controller can be mounted to industrial
"track" along with other automated elements, but also by a screw to
the machine wall or control panel.
8cm high and divided vertically into two areas: a lower one with a
converter of 220V~ at 24VDC and other voltages needed for running a CPU
unit; and, upper area with a CPU and memory, relays and digital inputs.
When you lift the small plastic cover
you'll see a connector to which an RS232 module is hooked up for serial
interface with a computer. This module is used when programming a PLC
controller to change programs or execution follow-up. When installing a
PLC it isn't necessary to install this module, but it is recommended
because of possible changes in software during operation.
To better inform programmers on PLC controller status, maker has provided
for four light indicators in the form of LED's.
Beside these indicators, there are status indicators for each individual
input and output. These LED's are found by the screw terminals and with
their status are showing input or output state. If input/output is active,
diode is lit and vice versa.
4.3 PLC controller output lines
Aside from transistor outputs in PNP and NPN connections, PLC can also have
relays as outputs. Existence of relays as outputs makes it easier to connect
with external devices. Model CPM1A contains exactly these relays as outputs.
There a 4 relays whose functional contacts are taken out on a PLC controller
housing in the form of screw terminals. In reality this looks as in picture
With activation of phototransistor, relay comes under voltage and activates a contact
between points A and B. Contacts A and B can in our case be either in
connection or interrupted. What state these contacts are in is determined by
a CPU through appropriate bits in memory location IR010. One example of
relay status is shown in a picture below. A true state of devices attached to these relays is
4.4 PLC controller input lines
Different sensors, keys, switches and other elements that can change status
of a joined bit at PLC input can be hooked up to the PLC controller inputs.
In order to realize a change, we need a voltage source to incite an input.
The simplest possible input would be a common key. As CPM1A PLC has a source
of direct voltage of 24V, the same source can be used to incite input
(problem with this source is its maximum current which it can give
continually and which in our case amounts to 0.2A). Since inputs to a PLC
are not big consumers (unlike some sensor where a stronger external supply
must be used) it is possible to take advantage of the existing source of
direct supply to incite all six keys.
4.5 How PLC controller
Basis of a PLC function is continual scanning of a program. Under scanning
we mean running through all conditions within a guaranteed period. Scanning
process has three basic steps:
Testing input status. First, a PLC checks each of the inputs with intention
to see which one of them has status ON or OFF. In other words, it checks
whether a sensor, or a switch etc. connected with an input is activated or
not. Information that processor thus obtains through this step is stored in
memory in order to be used in the following step.
Program execution. Here a PLC executes a program, instruction by
instruction. Based on a program and based on the status of that input as
obtained in the preceding step, an appropriate action is taken. This
reaction can be defined as activation of a certain output, or results can be
put off and stored in memory to be retrieved later in the following step.
Checkup and correction of output status. Finally, a PLC checks up output
status and adjusts it as needed. Change is performed based on the input
status that had been read during the first step, and based on the results of
program execution in step two. Following the execution of step 3 PLC returns
to the beginning of this cycle and continually repeats these steps. Scanning
time is defined by the time needed to perform these three steps, and
sometimes it is an important program feature.
4.6 CPM1A PLC controller memory map
By memory map we mean memory structure for a PLC controller. Simply said,
certain parts of memory have specific roles. If you look at the picture
below, you can see that memory for CPM1A is structured into 16-bit
words. A cluster of several such words makes up a region. All the regions
make up the memory for a PLC controller.
Unlike microcontroller systems
where only some memory locations have had their purpose clearly defined (ex.
register that contains counter value), a memory of PLC controller is
completely defined, and more importantly almost entire memory is addressable
in bits. Addressability in bits means that it is enough to write the address
of the memory location and a number of bits after it in order to manipulate
with it. In short, that would mean that something like this could be
written: "201.7=1" which would clearly indicate a word 201 and its bit 7
which is set to one.
Memory locations intended for PLC input and output. Some bits are directly
connected to PLC controller inputs and outputs (screw terminal). In our
case, we have 6 input lines at address IR000. One bit corresponds to each
line, so the first line has the address IR000.0, and the sixth IR000.5. When
you obtain a signal at the input, this immediately affects the status of a
corresponding bit. There are also words with work bits in this region, and
these work bits are used in a program as flags or certain conditional bits.
Special memory region for control bits and flags. It is intended first and
foremost for counters and interrupts. For example, SR250 is memory location
which contains an adjustable value, adjusted by potentiometer no.0 (in other
words, value of this location can be adjusted manually by turning a
When you move to a subprogram during program execution, all relevant data is
stored in this region up to the return from a subprogram.
It is of great importance to keep certain information even when supply
stops. This part of the memory is battery supported, so even when supply has
stopped it will keep all data found therein before supply stopped.
This is one more region with control bits and flags. This region contains
information on PLC status, errors, system time, and the like. Like HR
region, this one is also battery supported.
In case of connection with another PLC, this region is used for exchange of
Timer and counter region
This region contains timer and counter values. There are 128 values. Since
we will consider examples with timers and counters, we will discus this
region more later on.
Contains data related to setting up communication with a PC computer, and
data on errors.
Each region can be broken down to single words and meanings of its bits. In
order to keep the clarity of the book, this part is dealt with in
Attachments and we will deal with those regions here whose bits are mostly
used for writing.
1. IR and LR bits that are not used for their allocated functions can be
used as work bits.
2. The contents of the HR area, LR area, Counter area, and read/write DM
area are backed up by a capacitor. At 25 oC, the capacitor will back up
memory for 20 days.
3. When accessing a PV, TC numbers are used as word data; when accessing
Completing Flags, they are used as bit data.
4. Data in DM6144 to DM6655 cannot be overwritten from the program, but they
can be changed from a Peripheral Device
4.7 Timers and counters
Timers and counters are indispensable in PLC programming. Industry has to
number its products, determine a needed action in time, etc. Timing
functions is very important, and cycle periods are critical in many
There are two types of timers delay-off and delay-on. First is late with
turn off and the other runs late in turning on in relation to a signal that
activated timers. Example of a delay-off timer would be staircase lighting.
Following its activation, it simply turns off after few minutes.
Each timer has a time basis, or more precisely has several timer basis.
Typical values are: 1 second, 0.1 second, and 0,01 second. If programmer has
entered .1 as time basis and 50 as a number for delay increase, timer will
have a delay of 5 seconds (50 x 0.1 second = 5 seconds).
Timers also have to have value SV set in advance. Value set in advance or
ahead of time is a number of increments that timer has to calculate before
it changes the output status. Values set in advance can be constants or
variables. If a variable is used, timer will use a real time value of the
variable to determine a delay. This enables delays to vary depending on the
conditions during function. Example is a system that has produced two
different products, each requiring different timing during process itself.
Product A requires a period of 10 seconds, so number 10 would be assigned to
the variable. When product B appears, a variable can change value to what is
required by product B.
Typically, timers have two inputs. First is timer enable, or conditional
input (when this input is activated, timer will start counting). Second
input is a reset input. This input has to be in OFF status in order for a
timer to be active, or the whole function would be repeated over again. Some
PLC models require this input to be low for a timer to be active, other
makers require high status (all of them function in the same way basically).
However, if reset line changes status, timer erases accumulated value.
With a PLC controller by Omron there are two types of timers: TIM and TIMH.
TIM timer measures in increments of 0.1 seconds. It can measure from 0 to
999.9 seconds with precision of 0.1 seconds more or less.
Quick timer (TIMH) measures in increments of 0.01 seconds. Both timers are
"delay-on" timers of a lessening-style. They require assignment of a timer
number and a set value (SV). When SV runs out, timer output turns on.
Numbers of a timing counter refer to specific address in memory and must not
be duplicated (same number can not be used for a timer and a counter).