Introduction To PLC Controllers

Download as pdf
Download as pdf
You are on page 1of 44

mikroElektronika : books : Introduction to PLC controllers

Index
Development systems
Introduction to PLC controllers on-line
Contact us
FREE!

Previous page Table of contents Next Page

Introduction to PLC controllers


on-line, FREE! author: Nebojsa Matic

PLC are industrial microcontroller systems (in more recent times we meet processors instead of
microcontrollers) where hardware and software are specifically adapted to industrial environment. The
key to their success is the fact that you don't have to learn a new programming language to program
them. How do they work exactly ? How to connect a simple sensor ? How to program in ladder
diagram ? In this book you will find answers for this question and more...
E-mail a friend about this item

Contents:
Chapter I Operating system Chapter VII Examples

Introduction Introduction
1.1 Conventional control panel 7.1 Self-maintenance
1.2 Control panel with a PLC controller 7.2 Making large time intervals
1.3 Systematic approach to designing a process control system 7.3 Counter over 9999
7.4 Delays of ON and OFF status
Chapter II Introduction to PLC controllers 7.5 Alternate ON-OFF output
7.6 Automation of parking garage for 100 vehicles
Introduction
7.7 Operating a charge and discharge process
2.1 First programmed controllers
7.8 Automation of product packaging
2.2 PLC controller parts
7.9 Automation a storage door
2.3 Central processing Unit –CPU
2.4 Memory Appendix A Expanding the number of I/O lines
2.5 PLC controller programming
2.6 Power supply Introduction
2.7 Input to PLC controller A.1 Differences and similarities
2.8 Input adjustment interface A.2 Marking a PLC controller
2.9 PLC controller output A.3 Specific case
2.10 Output adjustment interface
2.11 Extension lines Appendix B Detailed memory map for PLC controller

Chapter III Connecting sensors and output devices Introduction


B.1 General explanation of memory regions

file:///D|/Dilawer/ELECTRONIC/Web/www.mikroe.com/en/books/plcbook/plcbook.htm (1 of 4)4/10/2008 3:21:01 AM


mikroElektronika : books : Introduction to PLC controllers

3.1 Sinking-Sourcing concept B.2 IR memory region


3.2 Input lines B.3 SR memory region
3.3 Output lines B.4 AR memory region
B.5 PC memory region
Chapter IV Architecture of a specific PLC controller
Appendix C PLC diagnostics
Introduction
4.1 Why OMRON? Introduction
4.2 CPM1A PLC controller C.1 Diagnostic functions of a PLC controller
4.3 PLC controller output lines C.2 Errors
4.4 PLC controller input lines C.3 Fatal errors
4.5 Memory map for CPM1A PLC controller C.4 User defined errors
C.5 Failure Alarm –FAL(06)
Chapter V Relay diagram C.6 Severe Failure Alarm –FALS(07)
C.7 MESSAGE –MSG(46)
Introduction
C.8 Syntax errors
5.1 Relay diagram
C.9 Algorithm for finding errors in a program
5.2 Normally open and Normally closed contacts
5.3 Short example Appendix D Numerical systems

Introduction
Chapter VI SYSWIN, program for PLC controller D.1 Decimal numerical system
programming D.2 Binary numerical system
D.3 Hexadecimal numerical system
Introduction
6.1 How to connect a PLC controller to a PC Appendix E Detailed set of instructions
6.2 SYSWIN program installation
6.3 Writing a first program
6.4 Saving a project
6.5 Program transfer to PLC controller Download:
6.6 Checkup of program function
6.7 Meaning of tool-bar icons
Disk1 [1.24Mb]
6.8 PLC controller function modes
6.9 RUN mode Disk2 [1.44Mb]
6.10 MONITOR mode Disk3 [1.44Mb]
6.11 PROGRAM-STOP mode
6.12 Program execution and monitoring
6.13 Program checkup during monitoring
6.14 Graphic display of dimension changes in a program

mikroElektronika recommends:

file:///D|/Dilawer/ELECTRONIC/Web/www.mikroe.com/en/books/plcbook/plcbook.htm (2 of 4)4/10/2008 3:21:01 AM


mikroElektronika : books : Introduction to PLC controllers

PIC PLC On-line book


System with 16 inputs and Components of electronic devices
16 outputs.
This book is meant for the people with desire to
PIC PLC is a system for installing into create electronic devices with their own hands.
devices as well as for developing All the examples are illustrated and each
industrial control. With 16 relays and component in the scheme is explained in
16 optocoupled inputs, power supply details. Beside the complex examples that can
and a box, it makes very flexible have practical application, there are also
system. [more?] elementary examples to guarantee successful
start for beginners. [more?]

To readers knowledge:

The contents published in the book "Introduction to PLC controllers" is subject to copyright and it must not be reproduced in any
form without an explicit written permission released from the editorial of mikroElektronika.

The contact address for the authorization regarding contents of this book: [email protected] .

The book was prepared with due care and attention, however the publisher doesn't accept any responsibility neither for the
exactness of the information published therein, nor for any consequences of its application.

Send us a comment on the book "Introduction to PLC controllers"


Subject: Comment:
Comment on PLC book
Name:

E-mail:

State:
USA

Submit Reset

PIC, PIC, PICmicro, and MPLAB is a registered and protected trademark of the Microchip Technology Inc. USA. Microchip logo and name are the
registered tokens of the Microchip Technology. Copyright 2003, Microchip Technology Inc. PIC BASIC PRO is a registered trade mark of
microEngineering Labs, Inc. OMRON and CPM1A are registered and protected trademarks of the OMRON Inc. All other tokens mentioned in the
book are the property of the companies to which they belong.All other tokens mentioned in the book are the property of the companies to which
they belong.

file:///D|/Dilawer/ELECTRONIC/Web/www.mikroe.com/en/books/plcbook/plcbook.htm (3 of 4)4/10/2008 3:21:01 AM


mikroElektronika : books : Introduction to PLC controllers

© C o p y r i g h t 2 0 0 3. m i k r o E l e k t r o n i k a. All Rights Reserved. For any comments contact webmaster.

file:///D|/Dilawer/ELECTRONIC/Web/www.mikroe.com/en/books/plcbook/plcbook.htm (4 of 4)4/10/2008 3:21:01 AM


Chapter1

Index
Development systems
Introduction to PLC controllers on-line
Contact us
FREE!

Previous page Table of contents Next Page

CHAPTER 1 Process control system


Introduction
1.1 Conventional control panel
1.2 Control panel with a PLC controller
1.3 Systematic approach to designing a process control system

Introduction

Generally speaking, process control system is made up of a group of electronic devices and equipment that provide
stability, accuracy and eliminate harmful transition statuses in production processes. Operating system can have
different form and implementation, from energy supply units to machines. As a result of fast progress in
technology, many complex operational tasks have been solved by connecting programmable logic controllers and
possibly a central computer. Beside connections with instruments like operating panels, motors, sensors, switches,
valves and such, possibilities for communication among instruments are so great that they allow high level of
exploitation and process coordination, as well as greater flexibility in realizing an process control system. Each
component of an process control system plays an important role, regardless of its size. For example, without a
sensor, PLC wouldn’t know what exactly goes on in the process. In automated system, PLC controller is usually the
central part of an process control system. With execution of a program stored in program memory, PLC
continuously monitors status of the system through signals from input devices. Based on the logic implemented in
the program, PLC determines which actions need to be executed with output instruments. To run more complex
processes it is possible to connect more PLC controllers to a central computer. A real system could look like the one
pictured below:

file:///D|/Dilawer/ELECTRONIC/Web/www.mikroe.com/en/books/plcbook/chapter1/chapter1.htm (1 of 5)4/10/2008 3:21:19 AM


Chapter1

1.1 Conventional control panel

At the outset of industrial revolution, especially during sixties and seventies, relays were used to operate
automated machines, and these were interconnected using wires inside the control panel. In some cases a control
file:///D|/Dilawer/ELECTRONIC/Web/www.mikroe.com/en/books/plcbook/chapter1/chapter1.htm (2 of 5)4/10/2008 3:21:19 AM
Chapter1

panel covered an entire wall. To discover an error in the system much time was needed especially with more
complex process control systems. On top of everything, a lifetime of relay contacts was limited, so some relays had
to be replaced. If replacement was required, machine had to be stopped and production too. Also, it could happen
that there was not enough room for necessary changes. control panel was used only for one particular process, and
it wasn’t easy to adapt to the requirements of a new system. As far as maintenance, electricians had to be very
skillful in finding errors. In short, conventional control panels proved to be very inflexible. Typical example of
conventional control panel is given in the following picture.

In this photo you can notice a large number of electrical wires, time relays, timers and other elements of
automation typical for that period. Pictured control panel is not one of the more “complicated” ones, so you can
imagine what complex ones looked like.

Most frequently mentioned disadvantages of a classic control panel are:

- Too much work required in connecting wires


- Difficulty with changes or replacements
- Difficulty in finding errors; requiring skillful work force
- When a problem occurs, hold-up time is indefinite, usually long.

1.2 Control panel with a PLC controller

With invention of programmable controllers, much has changed in how an process control system is designed.
Many advantages appeared. Typical example of control panel with a PLC controller is given in the following picture.

file:///D|/Dilawer/ELECTRONIC/Web/www.mikroe.com/en/books/plcbook/chapter1/chapter1.htm (3 of 5)4/10/2008 3:21:19 AM


Chapter1

Advantages of control panel that is based on a PLC controller can be presented in few basic points:

1. Compared to a conventional process control system, number of wires needed for connections is reduced by 80%
2. Consumption is greatly reduced because a PLC consumes less than a bunch of relays
3. Diagnostic functions of a PLC controller allow for fast and easy error detection.
4. Change in operating sequence or application of a PLC controller to a different operating process can easily be
accomplished by replacing a program through a console or using a PC software (not requiring changes in wiring,
unless addition of some input or output device is required).
5. Needs fewer spare parts
6. It is much cheaper compared to a conventional system, especially in cases where a large number of I/O
instruments are needed and when operational functions are complex.
7. Reliability of a PLC is greater than that of an electro-mechanical relay or a timer.

1.3 Systematic approach in designing an process control system

First, you need to select an instrument or a system that you wish to control. Automated system can be a machine
or a process and can also be called an process control system. Function of an process control system is constantly
watched by input devices (sensors) that give signals to a PLC controller. In response to this, PLC controller sends a
signal to external output devices (operative instruments) that actually control how system functions in an assigned
manner (for simplification it is recommended that you draw a block diagram of operations’ flow).

Secondly, you need to specify all input and output instruments that will be connected to a PLC controller. Input
devices are various switches, sensors and such. Output devices can be solenoids, electromagnetic valves, motors,
relays, magnetic starters as well as instruments for sound and light signalization.
Following an identification of all input and output instruments, corresponding designations are assigned to input
and output lines of a PLC controller. Allotment of these designations is in fact an allocation of inputs and outputs on
file:///D|/Dilawer/ELECTRONIC/Web/www.mikroe.com/en/books/plcbook/chapter1/chapter1.htm (4 of 5)4/10/2008 3:21:19 AM
Chapter1

a PLC controller which correspond to inputs and outputs of a system being designed.

Third, make a ladder diagram for a program by following the sequence of operations that was determined in the
first step.
Finally, program is entered into the PLC controller memory. When finished with programming, checkup is done for
any existing errors in a program code (using functions for diagnostics) and, if possible, an entire operation is
simulated. Before this system is started, you need to check once again whether all input and output instruments
are connected to correct inputs or outputs. By bringing supply in, system starts working.

Previous page Table of contents Next page

© Copyright 2003 mikroElektronika. A l l R i g h t s R e s e r v e d . F o r a n y c o m m e n t s c o n t a c t webmaster.

file:///D|/Dilawer/ELECTRONIC/Web/www.mikroe.com/en/books/plcbook/chapter1/chapter1.htm (5 of 5)4/10/2008 3:21:19 AM


Chapter2

Index
Development systems
Introduction to PLC controllers on-line
Contact us
FREE!

Previous page Table of contents Next Page

CHAPTER 2 Introduction to PLC controllers


Introduction
2.1 First programmed controllers
2.2 PLC controller parts
2.3 Central Processing unit -CPU
2.4 Memory
2.5 How to program a PLC controller
2.6 Power supply
2.7 Input to a PLC controller
2.8 Input adjustable interface
2.9 Output from a PLC controller
2.10 Output adjustable interface
2.11 Extension lines

Introduction

Industry has begun to recognize the need for quality improvement and increase in productivity in the sixties and
seventies. Flexibility also became a major concern (ability to change a process quickly became very important in
order to satisfy consumer needs).

Try to imagine automated industrial production line in the sixties and seventies. There was always a huge electrical
board for system controls, and not infrequently it covered an entire wall! Within this board there was a great
number of interconnected electromechanical relays to make the whole system work. By word "connected" it was
understood that electrician had to connect all relays manually using wires! An engineer would design logic for a
system, and electricians would receive a schematic outline of logic that they had to implement with relays. These
relay schemas often contained hundreds of relays. The plan that electrician was given was called "ladder
schematic". Ladder displayed all switches, sensors, motors, valves, relays, etc. found in the system. Electrician's
job was to connect them all together. One of the problems with this type of control was that it was based on
mechanical relays. Mechanical instruments were usually the weakest connection in the system due to their
moveable parts that could wear out. If one relay stopped working, electrician would have to examine an entire
system (system would be out until a cause of the problem was found and corrected).

The other problem with this type of control was in the system's break period when a system had to be turned off,
so connections could be made on the electrical board. If a firm decided to change the order of operations (make

file:///D|/Dilawer/ELECTRONIC/Web/www.mikroe.com/en/books/plcbook/chapter2/chapter2.htm (1 of 7)4/10/2008 3:21:35 AM


Chapter2

even a small change), it would turn out to be a major expense and a loss of production time until a system was
functional again.

It's not hard to imagine an engineer who makes a few small errors during his project. It is also conceivable that
electrician has made a few mistakes in connecting the system. Finally, you can also imagine having a few bad
components. The only way to see if everything is all right is to run the system. As systems are usually not perfect
with a first try, finding errors was an arduous process. You should also keep in mind that a product could not be
made during these corrections and changes in connections. System had to be literally disabled before changes
were to be performed. That meant that the entire production staff in that line of production was out of work until
the system was fixed up again. Only when electrician was done finding errors and repairing,, the system was ready
for production. Expenditures for this kind of work were too great even for well-to-do companies.

2.1 First programmable controllers

"General Motors" is among the first who recognized a need to replace the system's "wired" control board.
Increased competition forced auto-makers to improve production quality and productivity. Flexibility and fast and
easy change of automated lines of production became crucial! General Motors' idea was to use for system logic one
of the microcomputers (these microcomputers were as far as their strength beneath today's eight-bit
microcontrollers) instead of wired relays. Computer could take place of huge, expensive, inflexible wired control
boards. If changes were needed in system logic or in order of operations, program in a microcomputer could be
changed instead of rewiring of relays. Imagine only what elimination of the entire period needed for changes in
wiring meant then. Today, such thinking is but common, then it was revolutionary!

Everything was well thought out, but then a new problem came up of how to make electricians accept and use a
new device. Systems are often quite complex and require complex programming. It was out of question to ask
electricians to learn and use computer language in addition to other job duties. General Motors Hidromatic Division
of this big company recognized a need and wrote out project criteria for first programmable logic controller ( there
were companies which sold instruments that performed industrial control, but those were simple sequential
controllers û not PLC controllers as we know them today). Specifications required that a new device be based on
electronic instead of mechanical parts, to have flexibility of a computer, to function in industrial environment
(vibrations, heat, dust, etc.) and have a capability of being reprogrammed and used for other tasks. The last
criteria was also the most important, and a new device had to be programmed easily and maintained by
electricians and technicians. When the specification was done, General Motors looked for interested companies, and
encouraged them to develop a device that would meet the specifications for this project.

"Gould Modicon" developed a first device which met these specifications. The key to success with a new device was
that for its programming you didn't have to learn a new programming language. It was programmed so that same
language ûa ladder diagram, already known to technicians was used. Electricians and technicians could very easily
understand these new devices because the logic looked similar to old logic that they were used to working with.
Thus they didn't have to learn a new programming language which (obviously) proved to be a good move. PLC
controllers were initially called PC controllers (programmable controllers). This caused a small confusion when
Personal Computers appeared. To avoid confusion, a designation PC was left to computers, and programmable
controllers became programmable logic controllers. First PLC controllers were simple devices. They connected
inputs such as switches, digital sensors, etc., and based on internal logic they turned output devices on or off.
When they first came up, they were not quite suitable for complicated controls such as temperature, position,
pressure, etc. However, throughout years, makers of PLC controllers added numerous features and improvements.
file:///D|/Dilawer/ELECTRONIC/Web/www.mikroe.com/en/books/plcbook/chapter2/chapter2.htm (2 of 7)4/10/2008 3:21:35 AM
Chapter2

Today's PLC controller can handle highly complex tasks such as position control, various regulations and other
complex applications. The speed of work and easiness of programming were also improved. Also, modules for
special purposes were developed, like communication modules for connecting several PLC controllers to the net.
Today it is difficult to imagine a task that could not be handled by a PLC.

2.2 PLC controller components

PLC is actually an industrial microcontroller system (in more recent times we meet processors instead of
microcontrollers) where you have hardware and software specifically adapted to industrial environment. Block
schema with typical components which PLC consists of is found in the following picture. Special attention needs to
be given to input and output, because in these blocks you find protection needed in isolating a CPU blocks from
damaging influences that industrial environment can bring to a CPU via input lines. Program unit is usually a
computer used for writing a program (often in ladder diagram).

2.3 Central Processing Unit - CPU

Central Processing Unit (CPU) is the brain of a PLC controller. CPU itself is usually one of the microcontrollers.
Aforetime these were 8-bit microcontrollers such as 8051, and now these are 16- and 32-bit microcontrollers.
Unspoken rule is that you'll find mostly Hitachi and Fujicu microcontrollers in PLC controllers by Japanese makers,
Siemens in European controllers, and Motorola microcontrollers in American ones. CPU also takes care of
communication, interconnectedness among other parts of PLC controller, program execution, memory operation,
overseeing input and setting up of an output. PLC controllers have complex routines for memory checkup in order
to ensure that PLC memory was not damaged (memory checkup is done for safety reasons). Generally speaking,
CPU unit makes a great number of check-ups of the PLC controller itself so eventual errors would be discovered
early. You can simply look at any PLC controller and see that there are several indicators in the form of light diodes
for error signalization.

file:///D|/Dilawer/ELECTRONIC/Web/www.mikroe.com/en/books/plcbook/chapter2/chapter2.htm (3 of 7)4/10/2008 3:21:35 AM


Chapter2

2.4 Memory

System memory (today mostly implemented in FLASH technology) is used by a PLC for an process control system.
Aside from this operating system it also contains a user program translated from a ladder diagram to a binary
form. FLASH memory contents can be changed only in case where user program is being changed. PLC controllers
were used earlier instead of FLASH memory and have had EPROM memory instead of FLASH memory which had to
be erased with UV lamp and programmed on programmers. With the use of FLASH technology this process was
greatly shortened. Reprogramming a program memory is done through a serial cable in a program for application
development.

User memory is divided into blocks having special functions. Some parts of a memory are used for storing input
and output status. The real status of an input is stored either as "1" or as "0" in a specific memory bit. Each input
or output has one corresponding bit in memory. Other parts of memory are used to store variable contents for
variables used in user program. For example, timer value, or counter value would be stored in this part of the
memory.

2.5 Programming a PLC controller


file:///D|/Dilawer/ELECTRONIC/Web/www.mikroe.com/en/books/plcbook/chapter2/chapter2.htm (4 of 7)4/10/2008 3:21:35 AM
Chapter2

PLC controller can be reprogrammed through a computer (usual way), but also through manual programmers
(consoles). This practically means that each PLC controller can programmed through a computer if you have the
software needed for programming. Today's transmission computers are ideal for reprogramming a PLC controller in
factory itself. This is of great importance to industry. Once the system is corrected, it is also important to read the
right program into a PLC again. It is also good to check from time to time whether program in a PLC has not
changed. This helps to avoid hazardous situations in factory rooms (some automakers have established
communication networks which regularly check programs in PLC controllers to ensure execution only of good
programs).

Almost every program for programming a PLC controller possesses various useful options such as: forced switching
on and off of the system inputs/ouputs (I/O lines), program follow up in real time as well as documenting a
diagram. This documenting is necessary to understand and define failures and malfunctions. Programmer can add
remarks, names of input or output devices, and comments that can be useful when finding errors, or with system
maintenance. Adding comments and remarks enables any technician (and not just a person who developed the
system) to understand a ladder diagram right away. Comments and remarks can even quote precisely part
numbers if replacements would be needed. This would speed up a repair of any problems that come up due to bad
parts. The old way was such that a person who developed a system had protection on the program, so nobody
aside from this person could understand how it was done. Correctly documented ladder diagram allows any
technician to understand thoroughly how system functions.

2.6. Power supply

Electrical supply is used in bringing electrical energy to central processing unit. Most PLC controllers work either at
24 VDC or 220 VAC. On some PLC controllers you'll find electrical supply as a separate module. Those are usually
bigger PLC controllers, while small and medium series already contain the supply module. User has to determine
how much current to take from I/O module to ensure that electrical supply provides appropriate amount of current.
Different types of modules use different amounts of electrical current.

This electrical supply is usually not used to start external inputs or outputs. User has to provide separate supplies
in starting PLC controller inputs or outputs because then you can ensure so called "pure" supply for the PLC
controller. With pure supply we mean supply where industrial environment can not affect it damagingly. Some of
the smaller PLC controllers supply their inputs with voltage from a small supply source already incorporated into a
PLC.

2.7 PLC controller inputs

Intelligence of an automated system depends largely on the ability of a PLC controller to read signals from different
types of sensors and input devices. Keys, keyboards and by functional switches are a basis for man versus machine
relationship. On the other hand, in order to detect a working piece, view a mechanism in motion, check pressure or
fluid level you need specific automatic devices such as proximity sensors, marginal switches, photoelectric sensors,
level sensors, etc. Thus, input signals can be logical (on/off) or analogue. Smaller PLC controllers usually have only
digital input lines while larger also accept analogue inputs through special units attached to PLC controller. One of
the most frequent analogue signals are a current signal of 4 to 20 mA and milivolt voltage signal generated by
various sensors. Sensors are usually used as inputs for PLCs. You can obtain sensors for different purposes. They
can sense presence of some parts, measure temperature, pressure, or some other physical dimension, etc. (ex.
file:///D|/Dilawer/ELECTRONIC/Web/www.mikroe.com/en/books/plcbook/chapter2/chapter2.htm (5 of 7)4/10/2008 3:21:35 AM
Chapter2

inductive sensors can register metal objects).

Other devices also can serve as inputs to PLC controller. Intelligent devices such as robots, video systems, etc.
often are capable of sending signals to PLC controller input modules (robot, for instance, can send a signal to PLC
controller input as information when it has finished moving an object from one place to the other.)

2.8 Input adjustment interface

Adjustment interface also called an interface is placed between input lines and a CPU unit. The purpose of
adjustment interface to protect a CPU from disproportionate signals from an outside world. Input adjustment
module turns a level of real logic to a level that suits CPU unit (ex. input from a sensor which works on 24 VDC
must be converted to a signal of 5 VDC in order for a CPU to be able to process it). This is typically done through
opto-isolation, and this function you can view in the following picture.
Opto-isolation means that there is no electrical connection between external world and CPU unit. They are
"optically" separated, or in other words, signal is transmitted through light. The way this works is simple. External
device brings a signal which turns LED on, whose light in turn incites photo transistor which in turn starts
conducting, and a CPU sees this as logic zero (supply between collector and transmitter falls under 1V). When input
signal stops LED diode turns off, transistor stops conducting, collector voltage increases, and CPU receives logic 1
as information.

2.9 PLC controller output

Automated system is incomplete if it is not connected with some output devices. Some of the most frequently used
devices are motors, solenoids, relays, indicators, sound signalization and similar. By starting a motor, or a relay,
PLC can manage or control a simple system such as system for sorting products all the way up to complex systems
such as service system for positioning head of CNC machine. Output can be of analogue or digital type. Digital
output signal works as a switch; it connects and disconnects line. Analogue output is used to generate the
analogue signal (ex. motor whose speed is controlled by a voltage that corresponds to a desired speed).

2.10 Output adjustment interface

file:///D|/Dilawer/ELECTRONIC/Web/www.mikroe.com/en/books/plcbook/chapter2/chapter2.htm (6 of 7)4/10/2008 3:21:35 AM


Chapter2

Output interface is similar to input interface. CPU brings a signal to LED diode and turns it on. Light incites a photo
transistor which begins to conduct electricity, and thus the voltage between collector and emmiter falls to 0.7V ,
and a device attached to this output sees this as a logic zero. Inversely it means that a signal at the output exists
and is interpreted as logic one. Photo transistor is not directly connected to a PLC controller output. Between photo
transistor and an output usually there is a relay or a stronger transistor capable of interrupting stronger signals.

2.11 Extension lines

Every PLC controller has a limited number of input/output lines. If needed this number can be increased through
certain additional modules by system extension through extension lines. Each module can contain extension both
of input and output lines. Also, extension modules can have inputs and outputs of a different nature from those on
the PLC controller (ex. in case relay outputs are on a controller, transistor outputs can be on an extension module).

Previous page Table of contents Next page

© Copyright 2003 mikroElektronika. A l l R i g h t s R e s e r v e d . F o r a n y c o m m e n t s c o n t a c t webmaster.

file:///D|/Dilawer/ELECTRONIC/Web/www.mikroe.com/en/books/plcbook/chapter2/chapter2.htm (7 of 7)4/10/2008 3:21:35 AM


Chapter3

Index
Development systems
Introduction to PLC controllers on-line
Contact us
FREE!

Previous page Table of contents Next Page

CHAPTER 3 Connecting sensors and execution devices


Introduction
3.1 Sinking-sourcing concept
3.2 Input lines
3.3 Output lines

Introduction

Connecting external devices to a PLC controller regardless whether they are input or output is a special subject
matter for industry. If it stands alone, PLC controller itself is nothing. In order to function it needs sensors to obtain
information from environment, and it also needs execution devices so it could turn the programmed change into a
reality. Similar concept is seen in how human being functions. Having a brain is simply not enough. Humans
achieve full activity only with processing of information from a sensor (eyes, ears, touch, smell) and by taking
action through hands, legs or some tools. Unlike human being who receives his sensors automatically, when
dealing with controllers, sensors have to be subsequently connected to a PLC. How to connect input and output
parts is the topic of this chapter.

3.1 Sinking-Sourcing Concept

PLC has input and output lines through which it is connected to a system it directs. Input can be keys, switches,
sensors while outputs are led to different devices from simple signalization lights to complex communication
modules.

This is a very important part of the story about PLC controllers because it directly influences what can be
connected and how it can be connected to controller inputs or outputs. Two terms most frequently mentioned when
discussing connections to inputs or outputs are "sinking" and "sourcing". These two concepts are very important in
connecting a PLC correctly with external environment. The most brief definition of these two concepts would be:

SINKING = Common GND line (-)


SOURCING = Common VCC line (+)

First thing that catches one's eye are "+" and "-" supply, DC supply. Inputs and outputs which are either sinking or
sourcing can conduct electricity only in one direction, so they are only supplied with direct current.

According to what we've said thus far, each input or output has its own return line, so 5 inputs would need 10
file:///D|/Dilawer/ELECTRONIC/Web/www.mikroe.com/en/books/plcbook/chapter3/chapter3.htm (1 of 7)4/10/2008 3:21:51 AM
Chapter3

screw terminals on PLC controller housing. Instead, we use a system of connecting several inputs to one return line
as in the following picture. These common lines are usually marked "COMM" on the PLC controller housing.

3.2 Input lines

Explanation of PLC controller input and output lines has up to now been given only theoretically. In order to apply
this knowledge, we need to make it a little more specific. Example can be connection of external device such as
proximity sensor. Sensor outputs can be different depending on a sensor itself and also on a particular application.
Following pictures display some examples of sensor outputs and their connection with a PLC controller. Sensor
output actually marks the size of a signal given by a sensor at its output when this sensor is active. In one case
this is +V (supply voltage, usually 12 or 24V) and in other case a GND (0V). Another thing worth mentioning is
that sinking-sourcing and sourcing - sinking pairing is always used, and not sourcing-sourcing or sinking-sinking
pairing.

file:///D|/Dilawer/ELECTRONIC/Web/www.mikroe.com/en/books/plcbook/chapter3/chapter3.htm (2 of 7)4/10/2008 3:21:51 AM


Chapter3

If we were to make type of connection more specific, we'd get combinations as in following pictures (for more
specific connection schemas we need to know the exact sensor model and a PLC controller model).

file:///D|/Dilawer/ELECTRONIC/Web/www.mikroe.com/en/books/plcbook/chapter3/chapter3.htm (3 of 7)4/10/2008 3:21:51 AM


Chapter3

file:///D|/Dilawer/ELECTRONIC/Web/www.mikroe.com/en/books/plcbook/chapter3/chapter3.htm (4 of 7)4/10/2008 3:21:51 AM


Chapter3

3.3 Output lines

PLC controller output lines usually can be:

-transistors in PNP connection


-transistors in NPN connection
-relays

The following two pictures display a realistic way how a PLC manages external devices. It ought to be noted that a
main difference between these two pictures is a position of "output load device". By "output load device" we mean
some relay, signalization light or similar.

file:///D|/Dilawer/ELECTRONIC/Web/www.mikroe.com/en/books/plcbook/chapter3/chapter3.htm (5 of 7)4/10/2008 3:21:51 AM


Chapter3

How something is connected with a PLC output depends on the element being connected. In short, it depends on
whether this element of output load device is activated by a positive supply pole or a negative supply pole.

Previous page Table of contents Next page

file:///D|/Dilawer/ELECTRONIC/Web/www.mikroe.com/en/books/plcbook/chapter3/chapter3.htm (6 of 7)4/10/2008 3:21:51 AM


Chapter3

© Copyright 2003 mikroElektronika. A l l R i g h t s R e s e r v e d . F o r a n y c o m m e n t s c o n t a c t webmaster.

file:///D|/Dilawer/ELECTRONIC/Web/www.mikroe.com/en/books/plcbook/chapter3/chapter3.htm (7 of 7)4/10/2008 3:21:51 AM


Chapter7

Index
Development systems
Introduction to PLC controllers on-line
Contact us
FREE!

Previous page Table of contents Next Page

CHAPTER 7 EXAMPLES

Introduction
7.1 Self-maintenance
7.2 Making large time intervals
7.3 Delays of ON and OFF status
7.4 Counter over 9999
7.5 Alternate ON-OFF output
7.6 Automation of parking garage
7.7 Operating a charge and discharge process
7.8 Automation of product packaging
7.9 Automation of storage door

Introduction

Programming only related examples make up the first group of examples. They are given as separate small
programs that can later be incorporated into larger ones. Second group consists of examples which can be applied
to some real problems.

7.1 Self-maintenance

Program allows input to remain at ON status even when the condition that brought it to that status stops. Example
in picture below illustrates how use of a key connected to the input IR000.00 changes IR010.01 output status to
ON. By letting the key go, output IR010.01 is not reset. This is because IR010.01 output keeps itself at status ON
through OR circuit (having IR000.00), and it stays in this status until key at input IR000.01 is pressed. Input
IR000.01 is in I connection with the output pin IR010.01 which cancels out a condition, and resets an IR010.01 bit.
Example of self-maintenance is quite frequent in specific applications. If a user was connected to IR010.01 output,
START and STOP functions could be realized from two keys (without the use of switches). Specifically, input
IR000.00 would be a START key, and IR000.01 would be a STOP key.

file:///D|/Dilawer/ELECTRONIC/Web/www.mikroe.com/en/books/plcbook/chapter7/chapter7.htm (1 of 8)4/10/2008 3:22:02 AM


Chapter7

7.2 Making large time intervals

If it's necessary to make a bigger time interval of 999.9 seconds (9999x0.1s) two linked timers, or a timer and a
counter can be used as in this example. Counter is set to count to 2000, and timer is set to 5 seconds which gives
a time interval of 10.000 seconds or 2.77 hours. By executing a condition at IR000.00 input, timer begins to count.
When it reaches the limit, it sets a flag TIM001 which interrupts the link and simultaneously resets a timer. Once 5
seconds have run out, flag TIM001 changes its status to ON and executes a condition at the counter input CNT002.
When a counter numbers 2000 such changes in timer flag status, TIM001 sets its flag CNT002 which in turn
executes a condition for IR010.00 to change status to ON. Time that has elapsed from the change of IR000.00
input status to ON and a change of IR010.00 input status to ON comes to 10.000 seconds.

Ladder Diagram:

file:///D|/Dilawer/ELECTRONIC/Web/www.mikroe.com/en/books/plcbook/chapter7/chapter7.htm (2 of 8)4/10/2008 3:22:02 AM


Chapter7

7.3 Delays of ON and OFF status

Example shows how to make output (IR010.00) delay as opposed to ?(in relation to ?? unclear meaning) input
(IR000.00). By executing a condition at IR000.00 input, timer TIM000 begins counting a set value 10 in steps of
0.1 seconds each. After one second has elapsed, it set its flag TIM000 which is a condition in changing output
status IR010.00 to ON. Thus we accomplish a delay of one second between ON status of IR000.00 input and ON
status IR010.00 input. By changing IR010.00 output status to ON, half of the condition for activation of the second
timer is executed. Second half of the timer is executed when IR000.00 input changes status to OFF (normally
closed contact). Timer TIM001 sets its flag TIM001 after one second, and interrupts a condition for keeping an
output in ON status.

file:///D|/Dilawer/ELECTRONIC/Web/www.mikroe.com/en/books/plcbook/chapter7/chapter7.htm (3 of 8)4/10/2008 3:22:02 AM


Chapter7

Ladder Diagram:

7.4 Counter over 9999

If you need to count over 9999 (maximum value for a counter), you can use two connected timers. First counter
counts up to certain value, and the other one counts flag status changes of the first counter. Thus you get the
possibility of counting up to a value which is a result of set values of the first and second counter. In an example at
the bottom, first counter counts up to 1000, and second up to 20 which allows you to count to 20000. By executing
a condition at IR000.00 input (line whose changes are followed is brought to it), first counter decreases its value
by one. This is repeated until counter arrives at zero when it sets its flag CNT001 and simultaneously resets itself
(is made ready for a new cycle of counting from 1000 to 0). Each setting of CNT001 influences the other counter
which sets its flag after twenty settings of the first counter's flag. By setting CNT002 flag of the second counter, a
condition is executed for an IR010.00 output to be activated and to stay in that status through self-maintenance.

Ladder Diagram:

file:///D|/Dilawer/ELECTRONIC/Web/www.mikroe.com/en/books/plcbook/chapter7/chapter7.htm (4 of 8)4/10/2008 3:22:02 AM


Chapter7

Same effect can be achieved with a modified program below. First change is that there is a "switch" for the whole
program, and this is IR000.00 input (program can accomplish its function only while this switch is active). Second
change is that the line whose status is followed is brought to IR000.01 input. The rest is the same as in the
previous version of the program. Counter CNT002 counts status changes of the CNT001 counter flag. When it
numbers them, it changes the status of its flag CNT002 which executes the condition for status change of IR010.00
output. This changes IR010.00 output status after 20000 changes of input IR000.01.

Ladder Diagram:

file:///D|/Dilawer/ELECTRONIC/Web/www.mikroe.com/en/books/plcbook/chapter7/chapter7.htm (5 of 8)4/10/2008 3:22:02 AM


Chapter7

7.5 Alternate ON-OFF output

Example makes a certain number of impulses of desired duration at PLC controller IR010.00 output. Number of
impulses is given in instruction of the counter (here it is a constant #0010 or ten impulses) impulse duration in two
timer instructions. First timer defines duration of ON status, and second one duration of OFF status of IR010.00
output bit. In the example these two durations are the same, but through assigning them different parameters
they can differ so that duration of ON status can be different from duration of OFF status.

file:///D|/Dilawer/ELECTRONIC/Web/www.mikroe.com/en/books/plcbook/chapter7/chapter7.htm (6 of 8)4/10/2008 3:22:02 AM


Chapter7

Program starts executing a condition at IR000.00 bit. Since a normally closed contact which refers to counter flag
(that isn't set ) is linked with this IR000.00 bit in "I" circuit, this status of IR200.00 bit will change to ON. Bit
IR200.00 keeps its status through self-maintenance until counter flag is not set and a condition interrupted.

When an IR200.00 bit is set, timers TIM001 and TIM002 start counting a set interval number at 0.1 s ( in the
example, this number is 10 for the first timer, or 20 for the second timer, and this sets the period of one or two
seconds). With both timers, a normally closed contact which refers to TIM002 timer flag is connected with
IR200.00 bit. When this flag is set which happens every two seconds, both timers are reset. Timer TIM002 resets
timer TIM001 and itself, and this starts a new cycle.

At the start of a program, IR010.00 output bit changes status to ON and stays in this status until TIM001 flag
changes status to ON (after one second). By changing TIM001 flag status to ON, condition is broken (because it is
represented as normally closed contact) and IR010.00 bit changes status to OFF.

IR010.00 output status changes to ON again when time has run out on TIM002 timer. This resets TIM001 timer
and its flag which in turn executes a condition for status change of the IR010.00 output. Cycle is thus repeated
until a counter numbers 10 changes of TIM001 flag status. With the change of status of CNT000 counter flag, a
condition for an assisting bit IR200.00 is broken, and program stops working.

Ladder Diagram:

file:///D|/Dilawer/ELECTRONIC/Web/www.mikroe.com/en/books/plcbook/chapter7/chapter7.htm (7 of 8)4/10/2008 3:22:02 AM


Chapter7

Previous page Table of contents Next page

© Copyright 2003 mikroElektronika. A l l R i g h t s R e s e r v e d . F o r a n y c o m m e n t s c o n t a c t webmaster.

file:///D|/Dilawer/ELECTRONIC/Web/www.mikroe.com/en/books/plcbook/chapter7/chapter7.htm (8 of 8)4/10/2008 3:22:02 AM


APPENDIX A - Expanding the number of input/output lines

Index
Development systems
Introduction to PLC controllers on-line
Contact us
FREE!

Previous page Table of contents Next Page

APPENDIX A Expanding the number of input/output lines

INTRODUCTION

A.1 Differences and similarities

A.2 Marking the PLC controller

A.3 Specific case

Introduction

This appendix is an answer to the question “What if more input or output lines are needed ?”. Model detailed in the
book carries the mark CPM1A-10CDR-A and is taken as an optimal for it’s price and features. Alternative models
with greater number of lines include CPM1A-20CDR-A, CPM1A-30CDR-A or CPM1A-40CDR-A. The last two can be
expanded with three additional modules with 20 extra I/O lines each, totaling 100 I/O lines as a maximum (if this
is still insufficient, maybe it is time for you to start using some of more powerful PLC controllers).

If not even the most powerful model of CPM1A family satisfies your needs, then extra modules with 20 I/O lines
are added. This form of connection reaches 100 input/outputs, which is a significant number in industrial
proportions.

A.1. Differences and similarities

Taking the other model of PLC controller from CPM1A class basically doesn’t change a thing! Everything said for
one model also applies to the other. Only thing that changes is the number of screw terminal and the number of
bits in IR area connected to that screw terminal. If model with 10 I/O lines (model described in the book) has 6
inputs on addresses IR0000 - IR0005, then the 20 I/O lines model will have 12 inputs on addresses IR0000 -
IR0011. Expanding itself should not be a problem. After taking off the cover on the right side, there is a connector
which is then connected to the expansion module via flat cable. Still, it requires skill when assigning inputs and
file:///D|/Dilawer/ELECTRONIC/Web/www.mikroe.com/en/books/plcbook/app_a/app_a.htm (1 of 3)4/10/2008 3:22:13 AM
APPENDIX A - Expanding the number of input/output lines

outputs because expansion increases the cost of the project. All the models and expansions of CPM1A class carry
additional marks defining them more precisely.

Description Input points Output points Power Supply Model Number


10 I/O points 6 points 4 point Relay 100 to240 VAC, CPM1A-10CDR-A
Output 50/60 Hz

24 VDC CPM1A-10CDR-D
Transistor NPN 24 VDC CPM1A-l0CDT-D
Transistor PNP 24 VDC CPM1A-10CDT1-D
20 I/O points 12 points 8 points 100 to 240 VAC, CPMlA-20CDR-A
50/60 Hz
24 VDC CPM1A-20CDR-D
Transistor NPN 24 VDC CPM1A-20CDT-D
Transistor PNP 24 VDC CPMlA-20CDT1-D
30 I/O points 18 points 12 points 100 to 240 VAC, CPM1A-30CDR-A
50/60 Hz
24 VDC CPM1A-30CDR-D
Transistor NPN 24 VDC CPM1A-30CDT-D
Transistor PNP 24 VDC CPM1A-30CDT1-D
40 I/O points 24 points 16 points 100 to 240 VAC, CPM1A-40CDR-A
50/60 Hz
24 VDC CPM1A-40CDR-D
Transistor NPN 24 VDC CPM1A-40CDT-D
Transistor PNP 24 VDC CPM1A-40CDT1-D

Notice that PLC controllers with 10 and 20 I/O lines do not have an expansion port. Generally speaking, if there is
the slightest possibility for expansion in the project, PLC controller with 30 or 40 I/O lines should be used.

A.2. Marking the PLC controller

Marking the controller and the expansion module undergoes three criteria. The first is voltage, the second is the
type of input/output and the third is number of I/O lines. The picture below is self-explanatory.

file:///D|/Dilawer/ELECTRONIC/Web/www.mikroe.com/en/books/plcbook/app_a/app_a.htm (2 of 3)4/10/2008 3:22:13 AM


APPENDIX A - Expanding the number of input/output lines

A.3. Specific case

If two 20 I/O lines expansion modules and one analog module are added to 30 I/O lines model, assigned inputs/
outputs will have the addresses from the following table.

Unit Assigned input bits Assigned output bits


Central processing unit IR 00000-IR 00011 and IR 01000-IR 01007 and IR
1
(CPM2A-30CDX-X) IR 00100-IR 00105 01100-IR 01103
Unit for I/O expansion
2 IR 00200-IR 02011 IR 01200-IR 01207
(CPM1A-20EDxxx)
Analog I/O unit (CPM1A- IR 00300-IR 03015 and
3 IR 01300-IR 01315
MAD01) IR 00400-IR 00415
Unit for I/O expansion
4 IR 00500-IR 00511 IR 01400-IR 01415
(CPM1A-EDxxx)

Previous page Table of contents Next page

© C o p y r i g h t 2 0 0 3. m i k r o E l e k t r o n i k a. All Rights Reserved. For any comments contact webmaster.

file:///D|/Dilawer/ELECTRONIC/Web/www.mikroe.com/en/books/plcbook/app_a/app_a.htm (3 of 3)4/10/2008 3:22:13 AM


APPENDIX B - Detailed memory map of PLC controller

Index
Development systems
Introduction to PLC controllers on-line Contact us
FREE!

Previous page Table of contents Next Page

APPENDIX B Detailed memory map of PLC controller

INTRODUCTION

B.1 General explanation of memory areas

B.2 IR memory area

B.3 SR memory area

B.4 AR memory area

B.5 PC memory area

Introduction

Purpose of this appendix is to explain certain memory areas in detail. As the following tables cover whole memory,
there are options left unused in this book. They should be skipped during the first reading, and used later
according to needs.

B.1 General explanation of memory areas

Memory of PLC controller consists of several areas, some of these having predefined functions.

Data area Word(s) Bit(s) Function

file:///D|/Dilawer/ELECTRONIC/Web/www.mikroe.com/en/books/plcbook/app_b/app_b.htm (1 of 10)4/10/2008 3:22:26 AM


APPENDIX B - Detailed memory map of PLC controller

These bits may be assigned


IR 00000 - IR 00915 (160 to an external I/O
input area IR 000 - IR 009 (10 words)
bits) connection. Some of these
have direct output on screw
terminal (for example,
IR 01000 - IR 01915 (160 IR000.00 - IR000.05 and
IR area output area IR 010 - IR 019 (10 words)
bits) IR010.00 - IR010.03 with
CPM1A model)
Working bits that can be used
IR 20000 - IR 23115 (512 freely in the program. They
working area IR 200 - IR 231 (32 words)
bits) are commonly used as swap
bits
SR23200 - SR25515 (384 Special functions, such as
SR area SR 232 - SR 255 (24 words)
bits) flags and control bits
Temporary storage of ON/
TR area --- TR 0 - TR 7 (8 bits) OFF states when jump takes
place
Data storage; these keep
HR area HR 00 - HR 19 (20 words) HR0000 - HR1915 (320 bits)
their states when power is off
Special functions, such as
AR area AR 00 - AR 15 (16 words) AR0000 - AR1515 (256 bits)
flags and control bits
1:1 connection with another
LR area LR 00 - LR 15 (16 words) LR0000 - LR1515 (256 bits)
PC
Same numbers are used for
Timer/counter area TC 000 - TC 127 (timer/counter numbers)
both timers and counters
Data of DM area may be
DM 0000 - DM 0999 and DM accessed only in word form.
Read/write ---
1022 - DM 1023 (1002 words) Words keep their contents
after the power is off
Part of the memory for
DM 1000 - DM 1021 (22 storing the time and code of
Error writing --- error that occurred. When
words)
DM area not used for this purpose,
they can be used as regular
DM words for reading and
DM 6144 - DM 6599 (456 writing. They cannot be
Read only ---
words) changed from within the
program
DM 6600 - DM 6655 (56 Storing various parameters
PC setup ---
words) for controlling the PC

Note:
1. IR and LR bits, when not used to their purpose, may be used as working bits.
2. Contents of HR area, LR area, counter and DM area for reading/writing is stored within backup condenser. On
25C, condenser keeps the memory contents for up to 20 days.
3. When accessing the current value of PV, TC numbers used for data have the form of word. When accessing the
Completing flags, they are used as data bits. 4. Data from DM6144 to DM6655 must not be changed from within
the program, but can be changed by peripheral device.
file:///D|/Dilawer/ELECTRONIC/Web/www.mikroe.com/en/books/plcbook/app_b/app_b.htm (2 of 10)4/10/2008 3:22:26 AM
APPENDIX B - Detailed memory map of PLC controller

B.2. SR memory area

IR area doesn’t have predefined memory locations, but is meant for general use in the program. Of all the locations
this memory area consists of, only those directly connected to PLC controller input/output lines are of interest for
this appendix.

IR area can be divided into 3 parts:

1. Input area is located from word IR000 to IR009, totaling 160 bits. Most important of these are in the word
IR000 because they are directly connected to screw terminal of PLC controller. Input IR000.01 is directly connected
to screw terminal marked with 01 on the casing of the PLC controller.

2. Output area is located from word IR010 to IR019, totaling 160 bits. Most important of these are in the word
IR010 because they are directly connected to screw terminal of PLC controller. Output IR000.00 is directly
connected to screw terminal marked with 00 on the casing of the PLC controller.

3. Working area is located from word IR200 to IR231 totaling 512 bits for general use.

As IR memory area does not have predefined memory locations, more detailed explanations are not necessary.

B.3. IR memory area

Unlike IR area, SR area does have predefined memory locations. These bits are usually tied to the PLC controller
work or contain current and set values of different functions. Purpose of specific memory locations of SR area is
explained in the following table:

Words Bits Function


Input area for macro functions. Contains input operands for MCRO(99)
SR 232 - SR 235 00 - 15
(may be used for working bits, when MCRO(99) is not used)
Output area for macro functions. Contains output operands for MCRO(99)
SR 236 - SR 239 00 - 15
(may be used for working bits, when MCRO(99) is not used)
Contains set value SV, when input interrupt 0 is used in counter mode (4
SR 240 00 - 15 hexadecimal digits) (may be used for working bits, when input interrupt
0 is not used in counter mode)
Contains set value SV, when input interrupt 1 is used in counter mode (4
SR 241 00 - 15 hexadecimal digits) (may be used for working bits, when input interrupt
1 is not used in counter mode)
Contains set value SV, when input interrupt 2 is used in counter mode (4
SR 242 00 - 15 hexadecimal digits) (may be used for working bits, when input interrupt
2 is not used in counter mode)
file:///D|/Dilawer/ELECTRONIC/Web/www.mikroe.com/en/books/plcbook/app_b/app_b.htm (3 of 10)4/10/2008 3:22:26 AM
APPENDIX B - Detailed memory map of PLC controller

Contains set value SV, when input interrupt 3 is used in counter mode (4
SR 243 00 - 15 hexadecimal digits) (may be used for working bits, when input interrupt
3 is not used in counter mode)
Contains current value (PV-1), when input interrupt 0 is used in counter
SR 244 00 - 15
mode (4 hexadecimal digits)
Contains current value (PV-1), when input interrupt 1 is used in counter
SR 245 00 - 15
mode (4 hexadecimal digits)
Contains current value (PV-1), when input interrupt 2 is used in counter
SR 246 00 - 15
mode (4 hexadecimal digits)
Contains current value (PV-1), when input interrupt 3 is used in counter
SR 247 00 - 15
mode (4 hexadecimal digits)
Contains current value PV of the high-speed counter (may be used for
SR 248, SR 249 00 - 15
working bits, when high-speed counter is not used)
Analog setting of value 0. Keeps 4 digit BCD value (0000 - 0200) set via
SR 250 00 - 15
analog potentiometer on the PLC controller casing.
Analog setting of value 1. Keeps 4 digit BCD value (0000 - 0200) set via
SR 251 00 - 15
analog potentiometer on the PLC controller casing.
SR 252 00 Reset of the high-speed counter
01 - 07 Not used
Peripheral port. Switches on for the reset of the peripheral port (this
08 doesn't apply to a case when peripheral device is connected). Bit
automatically changes state to OFF after the reset
09 Not used
PLC Setup Reset Bit. When on, it initializes PC setup (DM6600-DM6655).
10 It automatically goes to OFF after the reset. This applies only if the PC is
in PROGRAM mode
Forced Status Hold Bit. OFF: bits used in the operation of forced set/reset
are cleared when changing from PROGRAM to MONITOR mode. ON: bits
11 used in the operation of forced set/reset keep their states when changing
from PROGRAM to MONITOR mode.
I/O Hold bit. OFF: IR and LR bits are reset when starting or ending an
12 operation. ON: IR and LR bits keep their states when starting or ending
an operation.
13 Not used
Error Log Reset Bit. Bit state OFF clears the record of error taking place.
14
Bit automatically goes off after the operation
15 Not used
FAL error code. Location contains error code (2 digit number). FAL
number is stored at this location upon executing FAL(06) or FAL(07)
SR 253 00 - 07
instructions. Location contents are reset upon executing FAL 00
instruction or by clearing an error from peripheral device
08 Not used
Cycle Time Overrun Flag. Bit goes to ON when program length doesn't
09 allow cycle of input/output scanning to be executed in a specified time
period

file:///D|/Dilawer/ELECTRONIC/Web/www.mikroe.com/en/books/plcbook/app_b/app_b.htm (4 of 10)4/10/2008 3:22:26 AM


APPENDIX B - Detailed memory map of PLC controller

10 - 12 Not used
13 Flag always on
14 Flag always off
First Cycle Flag. Goes ON during the first cycle at the beginning of the
15
operation
SR 254 00 1 min clock impulse (30s on, 30s off)
01 0.02s clock impulse (0.01s on, 0.01s off)
02 Negative (N) flag
03 - 05 Not used
06 Differential Monitor Flag
07 STEP(8) execution flag
08 - 15 Not used
SR 255 00 0.1s clock impulse (0.05s on, 0.05s off)
01 0.2s clock impulse (0.1s on, 0.1s off)
02 1.0s clock impulse (0.5s on, 0.5s off)
Instruction Execution Error (ER) Flag. Changes state to ON if error occurs
03
during instruction execution
04 Carry (CY) flag
05 "Greater than" (GR) flag
06 "Equals" (EQ) flag
07 "Less than" (LE) flag
08 - 15 Not used

B.4. AR memory area

Purpose of this memory area is to provide information on PLC controller state, malfunctions and some system data.
Memory locations of this area keep their states after the power has been shut down.

Word(s) Bit(s) Function


AR00 and AR01 00 - 15 Not used
Status flag of the first I/O unit for expanding I/O lines (I/O units status
AR02 00
flag)

file:///D|/Dilawer/ELECTRONIC/Web/www.mikroe.com/en/books/plcbook/app_b/app_b.htm (5 of 10)4/10/2008 3:22:26 AM


APPENDIX B - Detailed memory map of PLC controller

Status flag of the second I/O unit for expanding I/O lines (I/O units
01
status flag)
Status flag of the third I/O unit for expanding I/O lines (I/O units status
02
flag)
03 - 07 Not used
12 - 15 Number of connected I/O units
AR03 - AR07 00 - 15 Not used
AR08 00 - 07 Not used
08 - 11 Peripheral device error code
12 Flag of peripheral device error
13 Peripheral Device Transmission Enabled Flag
14 - 15 Not used
AR09 00 - 15 Not used
AR10 00 - 15 Power-off counter. Contains 4-digit BCD value
AR11 00 - 07 High-speed Counter Range Comparison Flags
08 - 14 Not used
15 Pulse Output Status. ON: stopped; OFF: Impulse at output
AR12 00 - 15 Not used
Power-up PC Setup Error Flag. Goes ON when error occurs in area DM
AR13 00
6600 - DM 6614
Start-up PC Setup Error Flag. Goes ON when error occurs in area DM
01
6615 - DM 6644
RUN PC Setup Error Flag. Goes ON when error occurs in area DM 6645 -
02
DM 6655
03 - 04 Not used
Long Cycle Time Flag. Goes ON if real cycle length exceeds length set in
05
DM 6619
06 - 07 Not used
Memory Area Specification Error Flag. Goes ON when non-existing
08
address is specified in the program
09 Flash Memory Error Flag
Read-only DM Error Flag. Goes ON when checksum error occurs in DM
10
6144 - DM 6599 range
PC Setup Error Flag. Goes ON when checksum error occurs in PC Setup
11
area
Program Error Flag. Goes ON when checksum error occurs in program
12
memory (UM) or inappropriate instruction is executed
13 Expansion Instruction Error Flag
14 - 15 Not used

file:///D|/Dilawer/ELECTRONIC/Web/www.mikroe.com/en/books/plcbook/app_b/app_b.htm (6 of 10)4/10/2008 3:22:26 AM


APPENDIX B - Detailed memory map of PLC controller

Maximum Cycle Time. 4 BCD digits. Cleared at the beginning of the


AR14 00 - 15
operation
AR15 00 - 15 Current Cycle Time. 4 BCD digits. Not cleared when the operation ends

Note:
1. IR and LR bits when not used for their function may be used as working bits.
2. Contents of HR area, LR area, counter, and DM area for reading/writing are kept by battery of central processing
unit. In case that the battery is removed or malfunction occurs, this data will be lost.
3. When accessing the current value of PV, TC numbers used for data have form of word. When accessing
Completing flags, they are used as data bits.
4. Data stored from DM6144 to DM6655 cannot be changed from within the program, but can be changed by
peripheral device.
5. Program and data from DM 6144 to DM 6655 are stored in the flash memory.

B.5. PC memory area

PLC setup area can be roughly divided into 4 categories:

1. Settings related to basic operations of PLC controller and I/O processes


2. Settings related to cycle duration
3. Settings related to interrupts
4. Settings related to communication.

Word(s) Bit(s) Function


Settings are active only upon resetting the PLC and sending data from PC to PLC
Startup Mode. Active only if bits 08 - 15 are set to 02. 00: PROGRAM;
DM 6600 00 - 07
01: MONITOR; 02: RUN
Startup mode designation. 00: programming console switch; 01:
08 - 15 proceeds in the mode last used before turning off the power; 02: settings
in 00 - 07
DM 6601 00 - 07 Not used (set to 0)
08 - 11 IOM Hold Bit (SR 25212). 0: Reset; 1: Keeps the state
12 - 15 Forced Status Hold Bit (SR 25211). 0: Reset; 1: Keeps the state
Writing to program memory protection. 00: OFF; 01: ON (except for DM
DM 6602 00 - 03
6602)
04 - 07 Programming console display language. 00: English; 01: Japanese
08 - 11 Not used
DM 6603 00 - 15 Not used

file:///D|/Dilawer/ELECTRONIC/Web/www.mikroe.com/en/books/plcbook/app_b/app_b.htm (7 of 10)4/10/2008 3:22:26 AM


APPENDIX B - Detailed memory map of PLC controller

00: in case of battery malfunction, error will not be generated; 01: in


DM 6604 00 - 07
case of battery malfunction, error will be generated
08 - 15 Not used
DM 6605 - DM 6614 00 - 15 Not used
Cycle Time Settings (DM 6615 - DM 6619) take effect after the transfer to PC area, next time you start working
DM 6615 - DM 6616 00 - 15 Not used
Servicing time for peripheral port. Active when bits 08 - 15 are set to 01.
DM 6617 00 - 07
It is expressed in percentage of cycle time duration (00 to 99 (BCD))
Peripheral port servicing setting enable. 00: 5% of cycle duration; 01:
08 - 15
time defined in first half of the word
Cycle monitor time. Settings are identical to those of the second half of
DM 6618 00 - 07
the previous word
Cycle monitor enable (Setting in 00 to 07 x unit; 99 5 max). 00:120ms
08 - 15 (settings in bits 00-07 are disabled) ; 01: setting unit 10ms; 02: setting
unit 100ms; 03: setting unit 1s
Cycle time. 0000: variable (no minimum); 0001: up to 9999 (BCD).
DM 6619 00 - 15
Minimal time is expressed in ms
Interrupt Processing (DM 6620 - DM 6639) take effect after the transfer to PC area, next time you start working
Input constant for IR 00000 - IR 00002. 0: 0.8ms; 1: 1ms; 2: 2ms; 3:
DM 6620 00 - 03
4ms; 4: 8ms; 5: 16ms; 6: 32ms; 7: 64ms; 8: 128ms
Input constant for IR 00003 and IR 00004. Settings are same as with
04 - 07
bits 00-03
Input constant for IR 00005 and IR 00006. Settings are same as with
08 - 11
bits 00-03
Input constant for IR 00007 and IR 00011. Settings are same as with
12 - 15
bits 00-03
Input constant for IR 001. 0: 0.8ms; 1: 1ms; 2: 2ms; 3: 4ms; 4: 8ms;
DM 6621 00 - 07
5: 16ms; 6: 32ms; 7: 64ms; 8: 128ms
08 - 15 Input constant for IR 002. Settings are same as with IR 001
DM 6622 00 - 07 Input constant for IR 003. Settings are same as with IR 001
08 - 15 Input constant for IR 004. Settings are same as with IR 001
DM 6623 00 - 07 Input constant for IR 005. Settings are same as with IR 001
08 - 15 Input constant for IR 006. Settings are same as with IR 001
DM 6624 00 - 07 Input constant for IR 007. Settings are same as with IR 001
DM 6625 00 - 07 Input constant for IR 008. Settings are same as with IR 001
08 - 15 Input constant for IR 009. Settings are same as with IR 001
DM 6626 - DM 6627 00 - 15 Not used
Interrupt enabled on IR 00000. (0: regular input; 1: interrupt input; 2:
DM 6628 00 - 03
fast-reaction input)
Interrupt enabled on IR 00001. (0: regular input; 1: interrupt input; 2:
04 - 07
fast-reaction input)
Interrupt enabled on IR 00002. (0: regular input; 1: interrupt input; 2:
08 - 11
fast-reaction input)

file:///D|/Dilawer/ELECTRONIC/Web/www.mikroe.com/en/books/plcbook/app_b/app_b.htm (8 of 10)4/10/2008 3:22:26 AM


APPENDIX B - Detailed memory map of PLC controller

Interrupt enabled on IR 00003. (0: regular input; 1: interrupt input; 2:


12 - 15
fast-reaction input)
High-speed counter settings (DM 6640-DM 6644) take effect after the transfer to PC area, next time you start working
DM 6640 - DM 6641 00 - 15 Not used
DM 6642 00 - 03 High-speed counter mode. 0: counting up/down; 4: incremental mode
High-speed counter reset mode. 0: Z phase and software reset; 1:
04 - 07
software reset only
High-speed counter enable. 0: high-speed counter not used; 1: high-
08 - 15
speed counter used with settings 00-07
DM 6643 - DM 6644 00 - 15 Not used
Peripheral port settings take effect after the transfer to PC area
DM 6645 - DM 6649 00 - 15 Not used
Port settings. 00: standard (1 start bit, even parity, 2 stop bits,
DM 6650 00 - 07 9600bps); 01: Settings in DM 6651 (settings other than this cause error
and turn on AR 1302)
08 - 11 Area for 1:1 connection with a PC via peripheral port. 0: LR00-LR15
Modes of communication. 0: Host link; 2: one-to-one PC link (slave); 3:
12 - 15 one-to-one PC link (master); 4: NT link (settings other than this cause
error and turn on AR 1302)
Baud rate. 00: 1200 bps; 01: 2400 bps; 02: 4800 bps; 03: 9600 bps;
DM 6651 00 - 07
04: 19200 bps
Frame format (Start bits/Data bits/Stop bits/Parity). 00:1/7/1/even;
01:1/7/1/odd; 02:1/7/1/none; 03:1/7/2/even; 04:1/7/2/odd; 05:1/7/2/
08 - 15 none; 06:1/7/1/even; 07:1/7/1/odd; 08:1/7/1/none; 09:1/7/2/even;
10:1/7/2/odd; 11:1/7/2/none (settings other than this cause error
and turn on AR 1302)
Host Link Transmission Delay (0000 - 9999ms) (settings
DM 6652 00 - 15
other than this cause error and turn on AR 1302)
Host Link (00 - 31 BCD) (settings
DM 6653 00 - 07
other than this cause error and turn on AR 1302)
08 - 15 Not used
DM 6654 00 - 15 Not used
Error log settings (DM 6655) take effect after the transfer to PLC controller
Style. 0: move after 7 records; 1: keep only first 7 (no moving); 2-F:
DM 6655 00 - 03
no records
04 - 07 Not used
Cycle Time monitor Enable. 0: detect long cycles as non-fatal errors; 1:
08 - 11
do not detect long cycles
12 - 15 Not used

Previous page Table of contents Next page

file:///D|/Dilawer/ELECTRONIC/Web/www.mikroe.com/en/books/plcbook/app_b/app_b.htm (9 of 10)4/10/2008 3:22:26 AM


APPENDIX B - Detailed memory map of PLC controller

© C o p y r i g h t 2 0 0 3. m i k r o E l e k t r o n i k a. All Rights Reserved. For any comments contact webmaster.

file:///D|/Dilawer/ELECTRONIC/Web/www.mikroe.com/en/books/plcbook/app_b/app_b.htm (10 of 10)4/10/2008 3:22:26 AM

You might also like