Basics of PLCs
Basics of PLCs
Basics of PLCs
SIEMENS
Global network of innovation
Table of Contents
Introduction ..............................................................................2
PLCs .........................................................................................4
Number Systems ......................................................................8
Terminology ............................................................................ 14
Basic Requirements ................................................................23
S7-200 Micro PLCs .................................................................28
Connecting External Devices ..................................................39
Programming a PLC ................................................................41
Discrete Inputs/Outputs .........................................................49
Analog Inputs and Outputs .....................................................61
Timers .....................................................................................64
Counters ................................................................................. 71
High-Speed Instructions .........................................................75
Specialized Expansion Modules .............................................78
Review Answers .....................................................................84
Final Exam ..............................................................................85
1
Introduction
2
This knowledge will help you better understand customer
applications. In addition, you will be better able to describe
products to customers and determine important differences
between products. You should complete Basics of Electricity
before attempting Basics of PLCs. An understanding of many
of the concepts covered in Basics of Electricity is required
for Basics of PLCs. In addition you may wish to complete
Basics of Control Components. Devices covered in Basics
of Control Components are used with programmable logic
controllers.
3
PLCs
Drive Motors
Lights Pumps
4
Basic PLC Operation PLCs consist of input modules or points, a Central Processing
Unit (CPU), and output modules or points. An input accepts a
variety of digital or analog signals from various field devices
(sensors) and converts them into a logic signal that can be used
by the CPU. The CPU makes decisions and executes control
instructions based on program instructions in memory. Output
modules convert control instructions from the CPU into a digital
or analog signal that can be used to control various field devices
(actuators). A programming device is used to input the desired
instructions. These instructions determine what the PLC will do
for a specific input. An operator interface device allows process
information to be displayed and new control parameters to be
entered.
Motor Starter
(Actuator)
Output
Motor
PLC
5
Hard-Wired Control Prior to PLCs, many of these control tasks were solved with
contactor or relay controls. This is often referred to as hard-
wired control. Circuit diagrams had to be designed, electrical
components specified and installed, and wiring lists created.
Electricians would then wire the components necessary to
perform a specific task. If an error was made, the wires had
to be reconnected correctly. A change in function or system
expansion required extensive component changes and rewiring.
M OL T1
L1
M OL T2
460 VAC L2 Motor
M OL T3
L3
OL
1 M
CR
24 VAC
Start
Stop
2 CR
CR
Advantages of PLCs The same, as well as more complex tasks, can be done with
a PLC. Wiring between devices and relay contacts is done in
the PLC program. Hard-wiring, though still required to connect
field devices, is less intensive. Modifying the application and
correcting errors are easier to handle. It is easier to create
and change a program in a PLC than it is to wire and re-wire a
circuit.
6
Siemens PLCs Siemens makes several PLC product lines in the SIMATIC® S7
family. They are: S7-200, S7-300, and S7-400.
S7-300 and S7-400 The S7-300 and S7-400 PLCs are used in more complex
applications that support a greater number of I/O points. Both
PLCs are modular and expandable. The power supply and I/O
consist of separate modules connected to the CPU. Choosing
either the S7-300 or S7-400 depends on the complexity of
the task and possible future expansion. Your Siemens sales
representative can provide you with additional information on
any of the Siemens PLCs.
7
Number Systems
Decimal System Various number systems are used by PLCs. All number systems
have the same three characteristics: digits, base, weight. The
decimal system, which is commonly used in everyday life, has
the following characteristics:
Ten digits 0, 1, 2, 3, 4, 5, 6, 7, 8, 9
Base 10
Weights 1, 10, 100, 1000, ...
Two digits 0, 1
Base 2
Weights Powers of base 2 (1, 2, 4, 8, 16, ...)
8
Converting Binary The following steps can be used to interpret a decimal
to Decimal number from a binary value.
In the following example, the fourth and fifth columns from the
right contain a 1. The decimal value of the fourth column from
the right is 8, and the decimal value of the fifth column from
the right is 16. The decimal equivalent of this binary number is
24. The sum of all the weighted columns that contain a 1 is the
decimal number that the PLC has stored.
In the following example the fourth and sixth columns from the
right contain a 1. The decimal value of the fourth column from
the right is 8, and the decimal value of the sixth column from
the right is 32. The decimal equivalent of this binary number is
40.
Bits, Bytes, and Words Each binary piece of data is a bit. Eight bits make up one byte.
Two bytes, or 16 bits, make up one word.
9
Logic 0, Logic 1 Programmable controllers can only understand a signal that
is On or Off (present or not present). The binary system is a
system in which there are only two numbers, 1 and 0. Binary 1
indicates that a signal is present, or the switch is On. Binary 0
indicates that the signal is not present, or the switch is Off.
10
Hexadecimal Hexadecimal is another system used in PLCs. The hexadecimal
system has the following characteristics:
16 digits 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F
Base 16
Weights Powers of base 16 (1, 16, 256, 4096 ...)
The ten digits of the decimal system are used for the first ten
digits of the hexadecimal system. The first six letters of the
alphabet are used for the remaining six digits.
A = 10 D = 13
B = 11 E = 14
C = 12 F = 15
11
Conversion of Numbers The following chart shows a few numeric values in decimal,
binary, BCD, and hexadecimal representation.
12
Review 1
1. Identify the following:
Binary ____________
BCD ____________
Hexadecimal ____________
13
Terminology
PLC
Output 1 Motor
Motor Starter
(Actuator)
14
Discrete Input A discrete input, also referred to as a digital input, is an input
that is either in an ON or OFF condition. Pushbuttons, toggle
switches, limit switches, proximity switches, and contact
closures are examples of discrete sensors which are connected
to the PLCs discrete or digital inputs. In the ON condition a
discrete input may be referred to as a logic 1 or a logic high. In
the OFF condition a discrete input may be referred to as a logic
0 or a logic low.
15
Analog Inputs An analog input is a continuous, variable signal. Typical analog
inputs may vary from 0 to 20 milliamps, 4 to 20 milliamps,
or 0 to 10 volts. In the following example, a level transmitter
monitors the level of liquid in a tank. Depending on the level
transmitter, the signal to the PLC can either increase or
decrease as the level increases or decreases.
16
Analog Outputs An analog output is a continuous, variable signal. The output
may be as simple as a 0-10 VDC level that drives an analog
meter. Examples of analog meter outputs are speed, weight,
and temperature. The output signal may also be used on more
complex applications such as a current-to-pneumatic transducer
that controls an air-operated flow-control valve.
17
Programming A program consists of one or more instructions that accomplish
a task. Programming a PLC is simply constructing a set of
instructions. There are several ways to look at a program such
as ladder logic, statement lists, or function block diagrams.
Ladder Logic Ladder logic (LAD) is one programming language used with
PLCs. Ladder logic uses components that resemble elements
used in a line diagram format to describe hard-wired control.
Refer to the STEP course Basics of Control Components for
more information on line diagrams.
STEP 2000
Basics of
Control
Components
Ladder Logic Diagram The left vertical line of a ladder logic diagram represents the
power or energized conductor. The output element or instruction
represents the neutral or return path of the circuit. The right
vertical line, which represents the return path on a hard-wired
control line diagram, is omitted. Ladder logic diagrams are read
from left-to-right, top-to-bottom. Rungs are sometimes referred
to as networks. A network may have several control elements,
but only one output coil.
18
In the example program shown example I0.0, I0.1 and Q0.0
represent the first instruction combination. If inputs I0.0 and
I0.1 are energized, output relay Q0.0 energizes. The inputs could
be switches, pushbuttons, or contact closures. I0.4, I0.5, and
Q1.1 represent the second instruction combination. If either
input I0.4 or I0.5 are energized, output relay Q0.1 energizes.
Function Block Diagrams Function Block Diagrams (FBD) provide another view of a set of
instructions. Each function has a name to designate its specific
task. Functions are indicated by a rectangle. Inputs are shown
on the left-hand side of the rectangle and outputs are shown on
the right-hand side. The function block diagram shown below
performs the same function as shown by the ladder diagram
and statement list.
19
PLC Scan The PLC program is executed as part of a repetitive process
referred to as a scan. A PLC scan starts with the CPU reading
the status of inputs. The application program is executed using
the status of the inputs. Once the program is completed, the
CPU performs internal diagnostics and communication tasks.
The scan cycle ends by updating the outputs, then starts over.
The cycle time depends on the size of the program, the number
of I/Os, and the amount of communication required.
20
Memory Size Kilo, abbreviated K, normally refers to 1000 units. When talking
about computer or PLC memory, however, 1K means 1024. This
10
is because of the binary number system (2 =1024). This can be
1024 bits, 1024 bytes, or 1024 words, depending on memory
type.
ROM Read Only Memory (ROM) is a type of memory that data can
be read from but not written to. This type of memory is used
to protect data or programs from accidental erasure. ROM
memory is nonvolatile. This means a user program will not lose
data during a loss of electrical power. ROM is normally used to
store the programs that define the capabilities of the PLC.
21
Putting it Together The memory of the S7-200 is divided into three areas: program
space, data space, and configurable parameter space.
22
Basic Requirements
• PLC
• Programming Device
• Programming Software
• Connector Cable
23
Programming Devices The program is created in a programming device (PG) and then
transferred to the PLC. The program for the S7-200 can be
created using a dedicated Siemens SIMATIC S7 programming
device, such as a PG 720 (not shown) or PG 740, if STEP 7
Micro/WIN software is installed.
24
Software A software program is required in order to tell the PLC what
instructions it must follow. Programming software is typically
PLC specific. A software package for one PLC, or one family
of PLCs, such as the S7 family, would not be useful on other
PLCs. The S7-200 uses a Windows based software program
called STEP 7-Micro/WIN32. The PG 720 and PG 740 have STEP
7 software pre-installed. Micro/WIN32 is installed on a personal
computer in a similar manner to any other computer software.
Connector Cables PPI Connector cables are required to transfer data from the
(Point-to-Point Interface) programming device to the PLC. Communication can only
take place when the two devices speak the same language or
protocol. Communication between a Siemens programming
device and the S7-200 is referred to as PPI protocol (point-
to- point interface). An appropriate cable is required for a
programming device such as a PG 720 or PG 740. The S7-200
uses a 9-pin, D-connector. This is a straight-through serial device
that is compatible with Siemens programming devices (MPI
port) and is a standard connector for other serial interfaces.
SF/DIAG
25
A special cable is needed when a personal computer is used as
a programming device. Two versions of this cable are available.
One version, called an RS-232/PPI Multi-Master Cable, connects
a personal computer’s RS-232 interface to the PLC’s RS-485
connector. The other version, called a USB/PPI Multi-Master
Cable, connects a personal computer’s USB interface to the
PLC’s RS-485 connector.
26
Review 2
1. A switch or a pushbutton is a ____________ input.
a. PLC
b. Programming Device
c. Programming Software
d. Connector Cable
e. Printer
27
S7-200 Micro PLCs
S7-200 Models There are five S7-200 CPU types: CPU 221, CPU 222, CPU 224,
CPU 224XP, and CPU 226 and two power supply configurations
for each type.
28
S7-200 Features The S7-200 family includes a wide variety of CPUs and features.
This variety provides a range of features to aid in designing a
cost-effective automation solution. The following table provides
a summary of the major features, many of which will be
covered in this course.
Feature CPU 221 CPU 222 CPU 224 CPU 224XP CPU 226
Memory
Program (with run mode edit) 4096 Bytes 4096 Bytes 8192 Bytes 12288 Bytes 16384 Bytes
Program (w/o run mode edit) 4096 Bytes 4096 Bytes 12288 Bytes 16384 Bytes 24576 Bytes
User Data 2048 Bytes 2048 Bytes 8192 Bytes 10240 Bytes 10240 Bytes
Memory Type EEPROM EEPROM EEPROM EEPROM EEPROM
Memory Cartridge EEPROM EEPROM EEPROM EEPROM EEPROM
Data Backup (super cap) 50 Hours 50 Hours 100 Hours 100 Hours 100 Hours
Data Backup (opt. battery) 200 Days 200 Days 200 Days 200 Days 200 Days
I/O
Local Digital I/O 6 In/4 Out 8 In/6 Out 14 In/10 Out 14 In/10 Out 24 In/16 Out
Local Analog I/O None None None 2 In/1 Out None
Max Expansion Modules None 2 7 7 7
Instructions
Boolean Execution Speed 0.22 µs/Inst. 0.22 µs/Inst. 0.22 µs/Inst. 0.22 µs/Inst. 0.22 µs/Inst.
Internal Relays 256 256 256 256 256
Counters 256 256 256 256 256
TImers 256 256 256 256 256
Sequential Control Relays 256 256 256 256 256
For/Next Loops Yes Yes Yes Yes Yes
Integer Math (+-*/) Yes Yes Yes Yes Yes
Floating-Point Math (+-*/) Yes Yes Yes Yes Yes
Enhanced Features
4 (30 KHz),
High-Speed Counters 4 (30 KHz) 4 (30 KHz) 6 (30 KHz) 6 (30 KHz)
2 (200 KHz)
Analog Adjustments 1 1 2 2 2
Pulse Outputs (DC) 2 (20 KHz) 2 (20 KHz) 2 (20 KHz) 2 (100 KHz) 2 (20 KHz)
Timed Interrupts 2 (1 - 255ms) 2 (1 - 255ms) 2 (1 - 255ms) 2 (1 - 255ms) 2 (1 - 255ms)
Edge Interrupts 4 4 4 4 4
Real-Time Clock Optional Optional Built-In Built-In Built-In
Password Protection Yes Yes Yes Yes Yes
Communications
Number of Ports 1 (RS-485) 1 (RS-485) 1 (RS-485) 2 (RS-485) 2 (RS-485)
PPI, MPI, PPI, MPI, PPI, MPI, PPI, MPI, PPI, MPI,
Protocols Supported
Freeport Freeport Freeport Freeport Freeport
Peer-to-Peer PPI Master Mode (NETR/NETW) (NETR/NETW) (NETR/NETW) (NETR/NETW) (NETR/NETW)
29
Mode Switch and When the mode switch is in the RUN position the CPU is in the
Analog Adjustment run mode and executing the program. When the mode switch
is in the STOP position the CPU is stopped. When the mode
switch is in the TERM position the programming device can
select the operating mode.
SF/DIAG
30
Expansion Modules The S7-200 PLCs are expandable. Expansion modules contain
additional inputs and outputs. These are connected to the base
unit using a ribbon connector.
31
Available Expansion The CPU 221 comes with 6 digital inputs and 4 digital outputs.
These are not expandable. The CPU 222 comes with 8 digital
inputs and 6 digital outputs and will accept up to 2 expansion
modules. The CPU 224 and CPU 224XP come with 14 digital
inputs and 10 digital outputs and will accept up to 7 expansion
modules. The S7-226 comes with 24 digital inputs and 16
digital outputs and will accept up to 7 expansion modules.
6 Inputs, 4 Outputs
CPU221 No Expansion Modules (EM)
8 Inputs, 6 Outputs
CPU222 EM EM Up to 2 Expansion Modules
14 Inputs, 10 Outputs
CPU224 EM EM EM EM EM EM EM Up to 7 Expansion Modules
14 Inputs, 10 Outputs
CPU224XP EM EM EM EM EM EM EM 2 Analog In, 1 Analog Out
Up to 7 Expansion Modules
24 Inputs, 16 Outputs
CPU226 EM EM EM EM EM EM EM Up to 7 Expansion Modules
Status Indicators The CPU status indicators reflect the current mode of CPU
operation. When the CPU is in the RUN mode, the green RUN
indicator is lit. When the CPU is in the STOP mode, the yellow
STOP indicator is lit. The System Fault/Diagnostic (SF/DIAG)
indicator turns red for a system fault and yellow to indicate
certain diagnostic conditions.
32
Installing The S7-200 can be installed in one of two ways. A DIN clip
allows installation on a standard DIN rail. The DIN clip snaps
open to allow installation and snaps closed to secure the
unit on the rail. The S7-200 can also be panel mounted using
installation holes located behind the access covers.
24 VDC
Power Supply
Neutral
Ground Line
33
I/O Numbering S7-200 inputs and outputs are labeled at the wiring terminations
and next to the status indicators. These alphanumeric symbols
identify the I/O address to which a device is connected. This
address is used by the CPU to determine which input is present
and which output needs to be turned on or off. I designates
a discrete input and Q designates a discrete output. The first
number identifies the byte, the second number identifies the
bit. Input I0.0, for example, is byte 0, bit 0.
Input Devices
Connected Here
Pushbutton Switch
34
Input Simulator A convenient method of testing a program is to wire toggle
switches to the inputs. Input simulators with prewired toggle
switches are available for the S7-200s. Switches are wired
between the 24 VDC power supply (L+) and the inputs. For
example, the switch on the far left is wired between the first
input (0.0) and L+. When the switch is closed, 24 VDC is applied
to the input. This is referred to as a logic 1. When the switch
is open, 0 VDC is applied to the input. This is referred to as a
logic 0.
Light Relay
35
Optional Connector An optional fan-out connector allows for field wiring connections
to remain fixed when removing or replacing a CPU 221 or
CPU 222. The appropriate connector slides into either the input,
output, or expansion module terminals.
Removable Terminal Strip The CPU 224, CPU 224XP, and CPU 226 do not have an optional
fan-out connector. Instead, the terminal strips are removable.
This allows the field wiring connections to remain fixed when
removing or replacing the PLC.
36
Super Capacitor A super capacitor, so named because of its ability to maintain a
charge for a long period of time, protects data stored in RAM in
the event of a power loss. The RAM memory is typically backed
up on the CPU 221 and CPU 222 for 50 hours, and on the
CPU 224, CPU 224 XP, and CPU 226 for 100 hours.
37
Review 3
1. The five models of S7-200 are ____________ ,
____________ , ____________ , ____________, and
____________ .
a. Mode Switch
b. Expansion Port
c. Programming Port
d. Status Indicators
38
Connecting External Devices
SF/DIAG
Freeport Mode The programming port has a mode called freeport mode.
Freeport mode allows connectivity to various intelligent sensing
devices such as a bar code reader.
Bar-Code Decoder
Bar-Code Reader
39
Printer Freeport mode can also be used to connect to a non-SIMATIC
printer.
Freeport Mode
Programming Port
Connecting Cable
Serial to Parallel
Converter
IBM or
IBM Compatible PC
PPI Interconnection
40
Programming a PLC
High-Speed Instructions High-speed instructions allow for events and interrupts to occur
independent of the PLC scan time. These include high-speed
counters, interrupts, output, and transmit instructions.
41
Micro/WIN32 The programming software can be run Off-line or On-line. Off-
line programming allows the user to edit the ladder diagram
and perform a number of maintenance tasks. The PLC does
not need to be connected to the programming device in this
mode. On-line programming requires the PLC to be connected
to the programming device. In this mode program changes are
downloaded to the PLC. In addition, status of the input/output
elements can be monitored. The CPU can be started, stopped,
or reset.
42
Coils Coils represent relays that are energized when power flows
to them. When a coil is energized, it causes a corresponding
output to turn on by changing the state of the status bit
controlling that output to 1. That same output status bit may be
used to control normally open and normally closed contacts
elsewhere in the program.
Network 1
Network 2
Cursor
I0.2
43
An AND Operation Each rung or network on a ladder represents a logic operation.
The following programming example demonstrates an AND
operation. Two contact closures and one output coil are placed
on network 1. They were assigned addresses I0.0, I0.1, and
Q0.0. Note that in the statement list a new logic operation
always begins with a load instruction (LD). In this example I0.0
(input 1) and (A in the statement list) I0.1 (input 2) must be
true in order for output Q0.0 (output 1) to be true. It can also
be seen that I0.0 and I0.1 must be true for Q0.0 to be true by
looking at the function block diagram representation.
Input 1 I0.0
Output 1 Q0.0
Input 2 I0.1
44
An OR Operation In this example an OR operation is used in network 1. It can be
seen that if either input I0.2 (input 3) or (O in the statement list)
input I0.3 (input 4), or both are true, then output Q0.1 (output 2)
will be true.
Input 3 I0.4
Output 2 Q0.1
Input 4 I0.5
45
Testing a Program Once a program has been written it needs to be tested and
debugged. One way this can be done is to simulate the field
inputs with an input simulator, such as the one made for the
S7-200. The program is first downloaded from the programming
device to the CPU. The selector switch is placed in the RUN
position. The simulator switches are operated and the resulting
indication is observed on the output status indicator lamps.
Status Functions After a program has been loaded and is running in the PLC, the
actual status of ladder elements can be monitored using STEP
7 Micro/WIN32 software. The standard method of showing a
ladder element is by indicating the circuit condition it produces
when the device is in the deenergized or non operated state.
In the following illustration input 1 (I0.0) is programmed as a
normally open (NO) contact. In this condition, power will not
flow through the contacts to the output (Q0.0).
46
When viewing the ladder diagram in the status mode, control
elements that are active, or true (logic 1), are highlighted. In the
example shown the toggle switch connected to input 1 has
been closed. Power can now flow through the control element
associated with input 1 (I0.0) and activate the output (Q0.0). The
lamp will illuminate.
47
The following table shows the appearance of ladder elements in
the Off, forced, and On condition.
48
Discrete Inputs/Outputs
Light
Switch
49
The following drawing illustrates the sequence of events. A
switch is wired to the input module of the PLC. A lamp is wired
to the output module. The program is in the CPU. The CPU
scans the inputs. When it finds the switch open I0.0 receives
a binary 0. This instructs Q0.0 to send a binary 0 to the output
module. The lamp is off. When it finds the switch closed I0.0
receives a binary 1. This instructs Q0.0 to send a binary 1 to the
output module, turning on the lamp.
Program Instruction When the switch is open the CPU receives a logic 0 from input
I0.0. The CPU sends a logic 0 to output Q0.0 and the light is off.
50
Motor Starter Example The following example involves a motor start and stop circuit.
The line diagram illustrates how a normally open and a
normally closed pushbutton might be used in a control circuit.
In this example a motor started (M) is wired in series with
a normally open momentary pushbutton (Start), a normally
closed momentary pushbutton (Stop), and the normally closed
contacts of an overload relay (OL).
51
This closes the associated M and Ma (auxiliary contact located
in the motor starter) contacts. When the Start button is released
a holding circuit exists to the M contactor through the auxiliary
contacts Ma. The motor will run until the normally closed
Stop button is depressed, or the overload relay opens the OL
contacts, breaking the path of current flow to the motor starter
and opening the associated M and Ma contacts.
Motor Starter
(Actuator)
Output
Motor
PLC
52
Program Instruction A normally open Start pushbutton is wired to the first input
(I0.0), a normally closed Stop pushbutton is wired to the second
input (I0.1), and normally closed overload relay contacts (part
of the motor starter) are connected to the third input (I0.2).
The first input (I0.0), second input (I0.1), and third input (I0.2)
form an AND circuit and are used to control normally open
programming function contacts on Network 1. I0.1 status bit is
a logic 1 because the normally closed (NC) Stop Pushbutton is
closed. I0.2 status bit is a logic 1 because the normally closed
(NC) overload relay (OL) contacts are closed. Output Q0.0 is
also programmed on Network 1. In addition, a normally open set
of contacts associated with Q0.0 is programmed on Network
1 to form an OR circuit. A motor starter is connected to output
Q0.0.
53
When the Start pushbutton is pressed, output Q0.0 is now
true and on the next scan, when normally open contact Q0.0 is
solved, the contact will close and output Q0.0 will stay on even
if the Start pushbutton has been released.
54
When the Stop pushbutton is released I0.1 logic function will
again be true and the program ready for the next time the Start
pushbutton is pressed.
Expanding the Application The application can be easily expanded to include indicator
lights for RUN and STOP conditions. In this example a RUN
indicator light is connected to output Q0.1 and a STOP indicator
light is connected to output Q0.2.
Motor Starter
(Actuator)
Motor
Output Indicator Lights
PLC
55
It can be seen from the ladder logic that a normally open output
Q0.0 is connected on Network 2 to output Q0.1 and a normally
closed Q0.0 contact is connected to output Q0.2 on network
3. In a stopped condition output Q0.0 is off. The normally open
Q0.0 contacts on Network 2 are open and the RUN indicator,
connected to output Q0.1 light is off. The normally closed Q0.1
on Network 3 lights are closed and the STOP indicator light,
connected to output Q0.2 is on.
56
When the PLC starts the motor output Q0.0 is now a logic
high (On). The normally open Q0.0 contacts on Network 2 now
switch to a logic 1 (closed) and output Q0.1 turns the RUN
indicator on. The normally closed Q0.0 contacts on Network
3 switch to a logic 0 (open) and the STOP indicator light
connected to output Q0.2 is now off.
Adding a Limit Switch The application can be further expanded by adding a limit
switch with normally open contacts to input I0.3.
Motor Starter
(Actuator)
Motor
Output Indicator Lights
PLC
57
A limit switch could be used to stop the motor or prevent the
motor from being started. An access door to the motor, or its
associated equipment, is one example of a limit switch’s use.
If the access door is open, the normally open contacts of LS1
connected to input I0.3 are open and the motor will not start.
58
Expansion The PLC program can be expanded to accommodate many
commercial and industrial applications. Additional Start/Stop
pushbuttons and indicator lights can be added for remote
operation, or control of a second motor starter and motor.
Overtravel limit switches can be added along with proximity
switches for sensing object position. In addition, expansion
modules can be added to further increase the I/O capability. The
applications are only limited by the number of I/Os and amount
of memory available on the PLC.
Motor Starters
(Digital Outputs)
Indicator Lights
(Digital Outputs)
Pushbuttons
(Digital Inputs) Sensors
(Digital Inputs)
59
Review 4
1. Identify the following symbols:
a. ____________
b. ____________
c. ____________
60
Analog Inputs and Outputs
SF/DIAG
61
Application Example A field device that measures a varying value is typically
connected to a transducer. In the following example a scale
is connected to a load cell. A load cell is a device that takes a
varying value and converts it to a variable voltage or current
output. In this example the load cell is converting a value of
weight into a 0 - 10 VDC output. The output value depends
entirely on the manufactured specifications for the device. This
load cell outputs 0 - 10 VDC for a 0 - 500 Lbs input. The 0 - 10
VDC load cell output is connected to the input of an analog
expansion module.
62
Analog Outputs Analog outputs are used in applications requiring control
capability of field devices which respond to continuous voltage
or current levels. Analog outputs may be used as a variable
reference for control valves, chart recorders, electric motor
drives, analog meters, and pressure transducers. Like analog
inputs, analog outputs are generally connected to a controlling
device through a transducer. The transducer takes the voltage
signal and, depending on the requirement, amplifies, reduces,
or changes it into another signal which controls the device. In
the following example a 0 - 10 VDC signal controls a 0 - 500 Lbs.
scale analog meter.
63
Timers
64
S7-200 Timers S7-200 timers are provided with resolutions of 1 millisecond,
10 milliseconds, and 100 milliseconds. The maximum value of
these timers is 32.767 seconds, 327.67 seconds, and 3276.7
seconds, respectively. By adding program elements, logic can
be programmed for much greater time intervals.
Hard-Wired Timing Circuit Timers used with PLCs can be compared to timing circuits used
in hard-wired control line diagrams. In the following example, a
normally open (NO) switch (S1) is used with a timer (TR1). For
this example the timer has been set for 5 seconds. When S1
is closed, TR1 begins timing. When 5 seconds have elapsed,
TR1 will close its associated normally open TR1 contacts,
illuminating pilot light PL1. When S1 is open, deenergizing TR1,
the TR1 contacts open, immediately extinguishing PL1. This type
of timer is referred to as ON delay. ON delay indicates that once
a timer receives an enable signal, a predetermined amount of
time (set by the timer) must pass before the timer’s contacts
change state.
On-Delay (TON) When the On-Delay timer (TON) receives an enable (logic 1) at
its input (IN), a predetermined amount of time (preset time - PT)
passes before the timer bit (T-bit) turns on. The T-bit is a logic
function internal to the timer and is not shown on the symbol.
The timer resets to the starting time when the enabling input
goes to a logic 0.
65
In the following simple timer example, a switch is connected to
input I0.3, and a light is connected to output Q0.1.
I0.3 T37
IN TON
150 PT
T37 Q0.1
66
A small sample of the flexibility of PLCs is shown in the
following program logic. By reprogramming the T37 contact as
a normally closed contact, the function of the circuit is changed
to cause the indicator light to turn off only when the timer times
out. This function change was accomplished without changing
or rewiring I/O devices.
I0.3 T37
IN TON
150 PT
T37 Q0.1
Retentive On-Delay (TONR) The Retentive On-Delay timer (TONR) functions in a similar
manner to the On-Delay timer (TON). There is one difference.
The Retentive On-Delay timer times as long as the enabling
input is on, but does not reset when the input goes off. The
timer must be reset with a RESET (R) instruction.
67
The same example used with the On-Delay timer will be
used with the Retentive On-Delay timer. When the switch is
closed at input I0.3, timer T5 (Retentive timer) begins timing.
If, for example, after 10 seconds input I0.3 is opened the timer
stops. When input I0.3 is closed the timer will begin timing at
10 seconds. The light will turn on 5 seconds after input I0.3
has been closed the second time. A RESET (R) instruction
can be added. Here a pushbutton is connected to input I0.2.
If after 10 seconds input I0.3 were opened, T5 can be reset by
momentarily closing input I0.2. T5 will be reset to 0 and begin
timing from 0 when input I0.3 is closed again.
I0.2 T5
I0.3
T5
IN TONR
150 PT
T5 Q0.1
Off-Delay (TOF) The Off-Delay timer is used to delay an output off for a fixed
period of time after the input turns off. When the enabling bit
turns on the timer bit turns on immediately and the value is set
to 0. When the input turns off, the timer counts until the preset
time has elapsed before the timer bit turns off.
TXXX
IN TOF
PT
68
S7-200 Timers The S7-200s have 256 timers. The specific T number chosen
for the timer determines its time base and whether it is TON,
TONR, or TOF.
Timer Example In the following example a tank will be filled with two
chemicals, mixed, and then drained. When the Start Button is
pressed at input I0.0, the program starts pump 1 controlled by
output Q0.0. Pump 1 runs for 5 seconds, filling the tank with
the first chemical, then shuts off. The program then starts pump
2, controlled by output Q0.1. Pump 2 runs for 3 seconds filling
the tank with the second chemical. After 3 seconds pump 2
shuts off. The program starts the mixer motor, connected to
output Q0.2 and mixes the two chemicals for 60 seconds. The
program then opens the drain valve controlled by output Q0.3,
and starts pump 3 controlled by output Q0.4. Pump 3 shuts off
after 8 seconds and the process stops. A manual Stop switch is
also provided at input I0.1.
69
Review 5
1. Analog signals are converted into a ____________
format by the PLC.
70
Counters
71
Counters are represented by boxes in ladder logic. Counters
increment/decrement one count each time the input transitions
from off (logic 0) to on (logic 1). The counters are reset when
a RESET instruction is executed. S7-200 uses three types of
counters: up counter (CTU), down counter (CTD), and up/down
counter (CTUD).
S7-200 Counters There are 256 counters in the S7-200, numbered C0 through
C255. The same number cannot be assigned to more than
one counter. For example, if an up counter is assigned number
45, a down counter cannot also be assigned number 45. The
maximum count value of a counter is ±32,767.
XXX
CTU
CU
PV
72
Down Counter The down counter counts down from the preset value (PV) each
time CD transitions from a logic 0 to a logic 1. When the current
value is equal to zero the counter output bit (Q) turns on (not
shown). The counter resets and loads the current value with the
preset value (PV) when the load input (LD) is enabled.
XXX
CTD
CD
LD
PV
Up/Down Counter The up/down counter counts up or down from the preset value
each time either CD or CU transitions from a logic 0 to a logic 1.
When the current value is equal to the preset value, the output
QU turns on. When the current value (CV) is equal to zero, the
output QD turns on. The counter loads the current value (CV)
with the preset value (PV) when the load input (LD) is enabled.
Similarly, the counter resets and loads the current value (CV)
with zero when the reset (R) is enabled. The counter stops
counting when it reaches preset or zero.
XXX
CTUD
CD
CU
R
LD
PV
73
Counter Example A counter might be used to keep track of the number of
vehicles in a parking lot. As vehicles enter the lot through an
entrance gate, the counter counts up. As vehicles exit the lot
through an exit gate, the counter counts down. When the lot is
full a sign at the entrance gate turns on indicating the lot is full.
74
High-Speed Instructions
75
Definition Boxes and The high-speed counter definition boxes are used to assign
High-Speed Counters a mode to the counter. High-speed counters can be defined
by the definition box to operate in any of the twelve available
modes. It should be noted that not all counters can operate
in all of the available modes. Refer to the S7-Programmable
Controller System Manual for definitions available for each
counter. Each counter has dedicated inputs for clocks, direction
control, reset, and start where these functions are supported.
0 1 2 3 4 5 6 7 8 9 10
Encoder Motor
Starter
1. Communications
2. I/O Interrupts
3. Time-Based Interrupts
76
PTO Pulse Train Output (PTO) is used to provide a series of pulses
to an output device, such as a stepper motor driver. The PTO
provides a square wave output for a specified number of pulses
and a specified cycle time. The number of pulses can be from
1 to 4,294,967,295 pulses. PTOs have a 50% duty cycle. This
means the pulse is off for the same amount of time it is on. The
number of pulses and the cycle time can be changed with an
interrupt. In the following example each pulse is on for 500 ms,
and off for 500 ms. After four pulses an interrupt occurs which
changes the cycle time to 1000 ms.
Q0.0
4 Pulses 4 Pulses
500 milliseconds Each 1000 milliseconds Each
Interrupt
Occurs
On Off On Off
Q0.0
10% 50%
Duty Cycle Duty Cycle
77
Specialized Expansion Modules
78
Ethernet Communications
CP 243-1 Ethernet
CP 243-1 IT Internet
79
PROFIBUS DP PROFIBUS DP is an open bus standard for a wide range
of applications in various manufacturing and automation
processes. PROFIBUS DP works at the field device level such
as power meters, motor protectors, circuit breakers, and lighting
controls. Through PROFIBUS DP the features of S7-200 PLCs
can be used to their full extent within a distributed system.
An advantage to PROFIBUS DP is the ability to communicate
between PROFIBUS DP devices of different vendors. This
provides uniform communication between all SIMATIC devices
on the PROFIBUS DP network as well as devices from other
manufacturers.
80
PLCs, for example, use I/O modules to receive inputs from
binary devices such as sensors. Binary outputs are used to turn
on or off a process as the result of an input.
Control
Actual Value
Stepper Motor
Power Module
Servo/Stepper
Servo Motor
81
EM 253 Features The EM 253 provides functionality for single-axis, open-loop
position control. Features of the module include:
• Continuous operation
Web Site For more information and sales support on the S7-200 visit our
web site at:
http://www.automation.siemens.com/s7-200/index_76.htm.
82
Review 6
1. The S7-200 supports ____________ counters.
83
Review Answers
84
Final Exam
a. 2 bits b. 8 bits
c. 16 bits d. 32 bits
a. 11 b. 100
c. 101 d. 111
a. analog b. discrete
c. high-speed d. normally open
a. RAM b. ROM
c. firmware d. K memory
85
7. A USB/PPI Multi-Master cable connects a personal
computer’s USB interface to a/an ____________ connector
on an S7-200 CPU.
a. RS-485 b. RS-232
c. Ethernet d. PROFIBUS-DP
a. none b. 7
c. 10 d. 30
a. 4 b. 8
c. 2 d. 5
a. I0.4 b. I0.3
c. Q0.3 d. Q0.4
a. two b. three
c. four d. five
a. 3.2767 b. 32.767
c. 327.67 d. 3276.7
86
15. An S7-200 timer with a time base of 100 ms can count to
a maximum value of ____________ seconds.
a. 3.2767 b. 32.767
c. 327.67 d. 3276.7
a. .1 b. 10
c. 1 d. 100
a. 32,767 b. 65,534
c. 98,301 d. 1,000,000
a. Transmit b. Interrupt
c. High-speed counters d. High-speed outputs
a. Transmit b. Forcing
c. Interrupt d. PLC scan
87
quickSTEP Online Courses
From this site the complete text of all STEP courses can be
downloaded in PDF format. These files contain the most recent
changes and updates to the STEP courses.
88