Introduction To PLC Controllers
Introduction To PLC Controllers
Introduction To PLC Controllers
Index
Development systems
Introduction to PLC controllers on-line
Contact us
FREE!
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
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:
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.
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.
Index
Development systems
Introduction to PLC controllers on-line
Contact us
FREE!
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:
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.
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.
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.
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.
Index
Development systems
Introduction to PLC controllers on-line
Contact us
FREE!
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
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.
"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.
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).
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.
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.
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.
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.
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
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.)
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.
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).
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.
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).
Index
Development systems
Introduction to PLC controllers on-line
Contact us
FREE!
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.
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:
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.
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.
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).
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.
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.
Index
Development systems
Introduction to PLC controllers on-line
Contact us
FREE!
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.
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:
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.
Ladder Diagram:
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:
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:
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.
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:
Index
Development systems
Introduction to PLC controllers on-line
Contact us
FREE!
INTRODUCTION
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.
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.
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.
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.
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.
Index
Development systems
Introduction to PLC controllers on-line Contact us
FREE!
INTRODUCTION
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.
Memory of PLC controller consists of several areas, some of these having predefined functions.
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
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.
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.
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:
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
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
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.
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
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.