Professional Documents
Culture Documents
Basics of PLCs
Basics of PLCs
Introduction...............................................................................2
PLCs..........................................................................................4
Number Systems.......................................................................8
Terminology............................................................................. 14
Basic Requirements.................................................................22
S7-200 Micro PLCs..................................................................26
Connecting External Devices...................................................37
Programming a PLC.................................................................39
Discrete Inputs/Outputs..........................................................47
Analog Inputs and Outputs......................................................57
Timers......................................................................................60
Counters..................................................................................67
High-Speed Instructions.......................................................... 71
Specialized Expansion Modules.............................................. 74
Review Answers......................................................................80
Final Exam...............................................................................81
quickSTEP Online Courses......................................................84
Introduction
PLCs
Drive Motors
Pumps
Lights
Photo Sensors
Pushbutton
Switches
Motor Starter
(Actuator)
Output
Motor
PLC
Input
Start/Stop Pushbuttons
(Sensors)
Hard-Wired Control
L1
460 VAC L2
L3
OL T1
OL T2
OL T3
Motor
OL
M
1
CR
24 VAC
Stop
Start
CR
2
CR
Advantages of PLCs
Siemens PLCs
S7-200
Number Systems
Binary System
0, 1
2
Powers of base 2 (1, 2, 4, 8, 16, ...)
Converting Binary
to Decimal
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.
Each binary piece of data is a bit. Eight bits make up one byte.
Two bytes, or 16 bits, make up one word.
Logic 0, Logic 1
BCD
10
Hexadecimal
D = 13
E = 14
F = 15
16 = 1
1
16 = 16
B = 11
11
Conversion of Numbers
12
Review 1
1.
Binary
____________
BCD
____________
Hexadecimal
____________
13
Terminology
Actuators
PLC
Output 1
Motor
Motor Starter
(Actuator)
14
Discrete Input
15
Analog Inputs
Discrete Outputs
Analog Outputs
16
CPU
Programming
Ladder Logic
17
18
PLC Scan
Software
Hardware
19
Memory Size
RAM
ROM
EPROM
Firmware
20
Putting it Together
21
Basic Requirements
PLC
Programming Devices
22
Software
23
SF/DIAG
24
Review 2
1.
a.
b.
c.
d.
e.
PLC
Programming Device
Programming Software
Connector Cable
Printer
10. An RS-232/PPI Multi-Master cable or a USB/PPI-MultiMaster cable may be used to connect a personal
computer to the PLCs __________ connector.
25
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.
Model Description
221 DC/DC/DC
221 AC/DC/Relay
222 DC/DC/DC
222 AC/DC/Relay
224 DC/DC/DC
224 AC/DC/Relay
224XP DC/DC/DC
Power Supply
20.4-28.8 VDC
85-264 VAC, 47-63 Hz
20.4-28.8 VDC
85-264 VAC, 47-63 Hz
20.4-28.8 VDC
85-264 VAC, 47-63 Hz
20.4-28.8 VDC
Input Types
6 DC
6 DC
8 DC
8 DC
14 DC
14 DC
14 DC, 2 Analog
Output Types
4 DC
4 Relay
6 DC
6 Relay
10 DC
10 Relay
10 DC, 1 Analog
224XP AC/DC/Relay
226 DC/DC/DC
226 AC/DC/Relay
20.4-28.8 VDC
85-264 VAC, 47-63 Hz
24 DC
24 DC
16 DC
16 Relay
26
S7-200 Features
Feature
Memory
CPU 221
CPU 222
CPU 224
CPU 224XP
CPU 226
4096 Bytes
4096 Bytes
8192 Bytes
12288 Bytes
16384 Bytes
4096 Bytes
4096 Bytes
12288 Bytes
16384 Bytes
24576 Bytes
User Data
Memory Type
Memory Cartridge
Data Backup (super cap)
Data Backup (opt. battery)
I/O
Local Digital I/O
Local Analog I/O
Max Expansion Modules
Instructions
Boolean Execution Speed
Internal Relays
Counters
TImers
Sequential Control Relays
For/Next Loops
Integer Math (+-*/)
Floating-Point Math (+-*/)
Enhanced Features
2048 Bytes
EEPROM
EEPROM
50 Hours
200 Days
2048 Bytes
EEPROM
EEPROM
50 Hours
200 Days
8192 Bytes
EEPROM
EEPROM
100 Hours
200 Days
10240 Bytes
EEPROM
EEPROM
100 Hours
200 Days
10240 Bytes
EEPROM
EEPROM
100 Hours
200 Days
6 In/4 Out
None
None
8 In/6 Out
None
2
14 In/10 Out
None
7
14 In/10 Out
2 In/1 Out
7
24 In/16 Out
None
7
0.22 s/Inst.
256
256
256
256
Yes
Yes
Yes
0.22 s/Inst.
256
256
256
256
Yes
Yes
Yes
0.22 s/Inst.
256
256
256
256
Yes
Yes
Yes
0.22 s/Inst.
256
256
256
256
Yes
Yes
Yes
0.22 s/Inst.
256
256
256
256
Yes
Yes
Yes
High-Speed Counters
4 (30 KHz)
4 (30 KHz)
6 (30 KHz)
Analog Adjustments
Pulse Outputs (DC)
Timed Interrupts
Edge Interrupts
Real-Time Clock
Password Protection
Communications
Number of Ports
1
2 (20 KHz)
2 (1 - 255ms)
4
Optional
Yes
1
2 (20 KHz)
2 (1 - 255ms)
4
Optional
Yes
2
2 (20 KHz)
2 (1 - 255ms)
4
Built-In
Yes
4 (30 KHz),
2 (200 KHz)
2
2 (100 KHz)
2 (1 - 255ms)
4
Built-In
Yes
1 (RS-485)
PPI, MPI,
Freeport
(NETR/NETW)
1 (RS-485)
PPI, MPI,
Freeport
(NETR/NETW)
2 (RS-485)
PPI, MPI,
Freeport
(NETR/NETW)
1 (RS-485)
PPI, MPI,
Protocols Supported
Freeport
Peer-to-Peer PPI Master Mode (NETR/NETW)
6 (30 KHz)
2
2 (20 KHz)
2 (1 - 255ms)
4
Built-In
Yes
2 (RS-485)
PPI, MPI,
Freeport
(NETR/NETW)
27
Optional Cartridge
SF/DIAG
28
Expansion Modules
29
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 CPU 226 comes with 24 digital inputs and 16
digital outputs and will accept up to 7 expansion modules.
CPU221
Status Indicators
6 Inputs, 4 Outputs
No Expansion Modules (EM)
8 Inputs, 6 Outputs
Up to 2 Expansion Modules
CPU222
EM
EM
CPU224
EM
EM
EM
EM
EM
EM
EM
CPU224XP
EM
EM
EM
EM
EM
EM
EM
CPU226
EM
EM
EM
EM
EM
EM
EM
14 Inputs, 10 Outputs
Up to 7 Expansion Modules
14 Inputs, 10 Outputs
2 Analog In, 1 Analog Out
Up to 7 Expansion Modules
24 Inputs, 16 Outputs
Up to 7 Expansion Modules
30
Mounting
24 VDC
Power Supply
Line
31
I/O Numbering
Inputs
Input Devices
Connected Here
Pushbutton
32
Switch
Input Simulator
Outputs
Relay
Light
Output Devices
Wired Here
33
Optional Connector
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.
Super Capacitor
34
Reference Manual
Preface, Contents
SIMATIC
S7-200
Programmable Controller
System Manual
Product Overview
Getting Started
PLC Concepts
Programming Concepts,
Conventions and Features
8
9
10
Using Recipes
13
14
15
11
12
Appendices
Index
This manual has the order number:
6ES7298-8FA24-8BH0
35
Review 3
1.
a.
b.
c.
d.
Mode Switch
Expansion Module
Programming Port
Status Indicators
36
TD 200
SF/DIAG
Programming
Device Cable
Freeport Mode
PPI Protocol
Bar-Code Reader
Programming Port
RS-485 to RS-232
Interface
Freeport Mode
37
Printer
Programming Port
Connecting Cable
Serial to Parallel
Converter
Interconnection
S7-200
S7-200
PPI Interconnection
38
S7-200
Programming a PLC
Standard Instructions
Special Instructions
High-Speed Instructions
39
Micro/WIN32
The programming software can be run off-line or on-line. Offline 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.
Symbols
Contacts
40
Coils
Boxes
Entering Elements
I0.1
Q0.0
Network 2
I0.2
Cursor
41
AND Operation
Output 1
Input 2
Input 1
0
0
1
1
42
Input 2
0
1
0
1
Output 1
0
0
0
1
I0.0
Q0.0
I0.1
I0.0
0
0
1
1
I0.1
0
1
0
1
Q0.0
0
0
0
1
OR Operation
Output 2
Input 4
Input 3
0
0
1
1
Or (O) Function
Input 4
0
1
0
1
Output 2
0
1
1
1
I0.4
Q0.1
I0.5
I0.4
0
0
1
1
I0.5
0
1
0
1
Q0.1
0
1
1
1
43
Testing a Program
Status Functions
After a program has been loaded and is running in the PLC, the
actual status of ladder elements can be monitored using STEP7
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 de-energized 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).
44
Forcing
45
46
Discrete Inputs/Outputs
Wiring
Switch
47
48
49
Motor Starter
(Actuator)
Output
Motor
PLC
Input
Program Instruction
Start/Stop Pushbuttons
(Sensors)
50
The output status bit for Q0.0 is now a 1. 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
is released.
51
Motor Starter
(Actuator)
Output
Motor
Indicator Lights
PLC
Input
52
Start/Stop Pushbuttons
(Sensors)
When the Start button is pressed, the PLC starts the motor.
Output Q0.0 is now on. The normally open Q0.0 contact on
Network 2 is now closed and the RUN indicator on. At the same
time, the normally closed Q0.0 contact on Network 3 is open
and the STOP indicator light connected to output Q0.2 is off.
Motor Starter
(Actuator)
Motor
Output
Indicator Lights
PLC
Input
Limit Switch
Start/Stop Pushbuttons
(Sensors)
53
54
Further Expansion
Motor Starters
(Digital Outputs)
Indicator Lights
(Digital Outputs)
Pushbuttons
(Digital Inputs)
Sensors
(Digital Inputs)
55
Review 4
1.
a. ____________
b. ____________
c. ____________
3. In the following network, coil Q0.0 will be on when
contact ____ is closed and either contact____ or contact
____ or both are closed.
56
Many PLCs also work with analog I/O devices. Analog devices
use signals that are continuously variable within a specified
range such as 0 to 10 VDC or 4 to 20 mA. Analog signals are
used to represent changing values such as speed, temperature,
weight, and level. In order to process an input of this type, a
PLC must convert the analog signal into a digital representation.
For an S7-200 PLC, this means that an expansion module
capable of converting the analog signal must be used. The
S7-200 analog modules convert standard voltage and current
analog values into a 12-bit digital representation. The digital
values are transferred to the PLC for use in register or word
locations.
In addition, analog modules are available for use with
thermocouple and RTD type sensors which sense the
temperature at a specific point in a machine or process.
SF/DIAG
57
Application Example
58
Analog Outputs
59
Timers
S7-200 Timers
60
61
T37
IN
150
T37
62
TON
PT
Q0.1
T37
IN
150
T37
TON
PT
Q0.1
63
I0.2
I0.3
T5
IN
150
PT
64
PT
Q0.1
T5
TONR
TOF
Timer Example
65
Review 5
1.
2. Three types of timers available in the S7-200 are OnDelay, __________ On-Delay, and ____-Delay.
3. The maximum time available with a 100 millisecond
time base timer is ____________ seconds.
4. A count of 25 on a 10 millisecond time base timer
represents a time of _______ milliseconds.
5. There are _______ timer numbers available in the S7200 PLC.
66
Counters
XXX
XXX
CTU
CTD
CTUD
CU
CD
CD
CU
LD
PV
PV
Count Up
Count Down
R
PV
Count Up/Down
67
S7-200 Counters
CU
PV
The Count Down Counter (CTD) counts down from the current
value each time the count down (CD) input goes from off to
on. When the current value is equal to zero, the counter bit for
designated counter is a logic 1. The counter stops counting at
zero. The counter resets and loads the current value with the
preset value (PV) when the load input (LD) turns on.
Cxx
CD
LD
PV
68
CTD
Cxx
CU
CTUD
CD
R
PV
Counter Example
69
I0.0
C48
CU
CTUD
I0.1
CD
I0.2
R
150
C48
70
PV
Q0.1
High-Speed Instructions
High-Speed Counters
71
Positioning Example
Encoder
Motor
Starter
72
9 10
Interrupts
PTO
Q0.0
4 Pulses
1000 milliseconds Each
4 Pulses
500 milliseconds Each
Interrupt
Occurs
PWM
Off
On
Off
Q0.0
10%
Duty Cycle
50%
Duty Cycle
73
74
Ethernet Communications
CP 243-1 Ethernet
CP 243-1 IT Internet
75
PROFIBUS DP
AS-i
76
EM 253
77
EM 253 Features
Continuous operation
For more information and sales support on the S7-200 visit our
web site at:
http://www.automation.siemens.com/_en/s7-200/Products/index.htm.
78
Review 6
1.
79
Review Answers
Review 1
80
Final Exam
a.
c.
2.
a.
2 bits
c. 16 bits
3.
a. 11
c. 101
4.
a.
c.
5.
a.
c.
6.
a.
c.
CPU
Programming device
analog
RTD
ladder logic
function blocks
RAM
R/W
b.
d.
b.
d.
Input/Output module
Operator interface
8 bits
32 bits
b. 100
d. 111
b.
d.
b.
d.
b.
d.
discrete
thermocouple
statement list
a flow chart
ROM
Read-Write
81
7.
a.
c.
8.
a.
8 DC inputs and 10 relay outputs
b.
8 AC inputs and 6 relay outputs
c. 14 DC inputs and 14 relay outputs
d. 14 DC inputs and 10 relay outputs
9.
a.
none
c. 10
RS-485
Ethernet
b.
d.
b.
d.
RS-232
PROFIBUS-DP
7
30
a. 1024
c.
2048
b.
8192
d. 10240
a.
c.
Read Inputs
Reset All Timers
b.
d.
Execute Program
Update Outputs
a. I0.4
c.
Q0.3
b.
d.
I0.3
Q0.4
a.
c.
two
four
b.
d.
three
five
a.
c.
3.2767
327.67
b.
d.
32.767
3276.7
a.
c.
3.2767
327.67
b.
d.
32.767
3276.7
a.
0.1
c. 1
b. 10
d. 100
a.
c.
32,767
98,301
b.
65,534
d. 1,000,000
a.
c.
CTUD
HSC
b.
d.
Interrupt
HDEF
a.
c.
EM 277
CP 243-1
b.
d.
EM241
CP 243-1 IT
a.
c.
Transmitting
Interrupting
b.
d.
Forcing
Holding
83
84