Home
Siemens
Controller
SIMATIC S7
System Manual
Page 126
Siemens SIMATIC S7 - Page 126
866 pages
Manual
To Next Page
To Next Page
To Previous Page
To Previous Page
Loading...
Programm
ing co
ncepts
5.6
Vari
able tabl
e
S7
-
200 SMART
126
System Manual
,
V2.3, 07/2017
,
A5E03822230
-
AF
Variable table example
The follow
ing ex
ample sh
ows
a typica
l vari
able tabl
e for
SBR_0, a
nd then
a call t
o SBR_0
from anoth
er progr
am bloc
k.
See also
Programm
ing so
ftware
(
Page
29
)
125
127
Table of Contents
Main Page
Default Chapter
3
Preface
3
Table of Contents
5
1 Product Overview
17
S7-200 Smart Cpu
18
New Features
21
CPU Feature Differences
23
S7-200 SMART Expansion Modules
26
HMI Devices for S7-200 SMART
27
Communications Options
28
Programming Software
29
2 Getting Started
31
Connecting to the CPU
31
Configuring the CPU for Communication
32
Overview
32
Establishing the Ethernet Hardware Communication Connection
33
Setting up Ethernet Communication with the CPU
34
Establishing the RS485 Hardware Communication Connection
36
Setting up RS485 Communication with the CPU
37
Creating the Sample Program
39
Network 1: Starting the Timer
40
Network 2: Turning the Output on
41
Network 3: Resetting the Timer
42
Setting the CPU Type and Version for Your Project
43
Saving the Sample Project
44
Downloading the Sample Program
45
Changing the Operating Mode of the CPU
46
3 Installation
47
Guidelines for Installing S7-200 SMART Devices
47
Power Budget
49
Installation and Removal Procedures
51
Mounting Dimensions for the S7-200 SMART Devices
51
Installing and Removing the CPU
52
Installing and Removing a Signal Board or Battery Board
55
Removing and Reinstalling the Terminal Block Connector
57
Installing and Removing an Expansion Module
58
Installing and Removing the Expansion Cable
60
Wiring Guidelines
62
4 PLC Concepts
69
Execution of the Control Logic
69
Reading the Inputs and Writing to the Outputs
71
Immediately Reading or Writing the I/O
71
Executing the User Program
72
Accessing Data
74
Accessing Memory Areas
75
Format for Real Numbers
82
Format for Strings
82
Assigning a Constant Value for Instructions
83
Addressing the Local and Expansion I/O
83
Using Pointers for Indirect Addressing
84
Pointer Examples
87
Saving and Restoring Data
89
Downloading Project Components
89
Uploading Project Components
92
Types of Storage
93
Using a Memory Card
94
Inserting a Memory Card in a Standard CPU
96
Transferring Your Program with a Memory Card
97
Restoring Data after Power on
99
Changing the Operating Mode of the CPU
100
Status Leds
101
5 Programming Concepts
103
Guidelines for Designing a PLC System
103
Elements of the User Program
105
Creating Your User Program
108
Earlier Versions of STEP 7-Micro/Win Projects
108
Using STEP 7-Micro/Win SMART User Interface
110
Using STEP 7-Micro/Win SMART to Create Your Programs
111
Using Wizards to Help You Create Your Control Program
112
Features of the LAD Editor
113
Features of the FBD Editor
114
Features of the STL Editor
114
Data Block (DB) Editor
115
Symbol Table
118
Variable Table
121
PLC Error Reaction
127
Non-Fatal Errors and I/O Errors
128
Fatal Errors
129
Program Edit in RUN Mode
130
Features for Debugging Your Program
132
6 PLC Device Configuration
133
Configuring the Operation of the PLC System
133
System Block
133
Configuring Communication
135
Configuring the Digital Inputs
138
Configuring the Digital Outputs
140
Configuring the Retentive Ranges
141
Configuring System Security
143
Configuring the Startup Options
147
Configuring the Analog Inputs
148
Reference to the Analog Inputs Technical Specifications
150
Configuring the Analog Outputs
151
Reference to the Analog Outputs Technical Specifications
152
Configuring the RTD Analog Inputs
153
Configuring the TC Analog Inputs
158
Configuring the RS485/RS232 CM01 Communications Signal Board
162
Configuring the BA01 Battery Signal Board
163
Clearing PLC Memory
164
Creating a Reset-To-Factory-Defaults Memory Card
167
High-Speed I/O
168
7 Program Instructions
169
Bit Logic
169
Standard Inputs
169
Immediate Inputs
171
Logic Stack Overview
172
STL Logic Stack Instructions
174
Not
176
Positive and Negative Transition Detectors
177
Coils: Output and Output Immediate Instructions
178
Set, Reset, Set Immediate, and Reset Immediate Functions
179
Set and Reset Dominant Bistable
180
NOP (no Operation) Instruction
181
Bit Logic Input Examples
182
Bit Logic Output Examples
183
Clock
185
Read and Set Real-Time Clock
185
Read and Set Real-Time Clock Extended
187
Communication
191
GET and PUT (Ethernet)
191
Transmit and Receive (Freeport on RS485/RS232)
199
Get Port Address and Set Port Address (PPI Protocol on RS485/RS232)
213
Get IP Address and Set IP Address (Ethernet)
214
Open User Communication
217
OUC Instructions
217
OUC Instruction Error Codes
228
Compare
230
Compare Number Values
230
Compare Character Strings
234
Convert
236
Standard Conversion Instructions
236
ASCII Character Array Conversion
240
Number Value to ASCII String Conversion
245
ASCII Sub-String to Number Value Conversion
249
Encode and Decode
252
Counters
253
Counter Instructions
253
High-Speed Counter Instructions
257
High-Speed Counter Summary
260
Noise Reduction for High-Speed Inputs
261
High-Speed Counter Programming
264
Example Initialization Sequences for High-Speed Counters
277
Pulse Output
285
Pulse Output Instruction (PLS)
285
Pulse Train Output (PTO)
287
Pulse Width Modulation (PWM)
289
Using SM Locations to Configure and Control the PTO/PWM Operation
290
Calculating the Profile Table Values
294
Math
297
Add, Subtract, Multiply, and Divide
297
Multiply Integer to Double Integer and Divide Integer with Remainder
300
Trigonometry, Natural Logarithm/Exponential, and Square Root
302
Increment and Decrement
305
Pid
307
Using the PID Wizard
308
PID Algorithm
313
Converting and Normalizing the Loop Inputs
317
Converting the Loop Output to a Scaled Integer Value
318
Forward- or Reverse-Acting Loops
319
Interrupt
322
Interrupt Instructions
322
Interrupt Routine Overview and CPU Model Event Support
324
Interrupt Programming Guidelines
326
Types of Interrupt Events that the S7-200 SMART CPU Supports
328
Interrupt Priority, Queuing, and Example Program
330
Logical Operations
335
Invert
335
AND, OR, and Exclusive or
336
Move
338
Move Byte, Word, Double Word, or Real
338
Block Move
339
Swap Bytes
340
Move Byte Immediate (Read and Write)
341
Program Control
342
FOR-NEXT Loop
342
JMP (Jump to Label)
344
SCR (Sequence Control Relay)
345
END, STOP, and WDR (Watchdog Timer Reset)
354
GET_ERROR (Get Non-Fatal Error Code)
356
Shift and Rotate
357
Shift Register Bit
360
String
362
String (Get Length, Copy, and Concatenate)
362
Copy Substring from String
364
Find String and First Character Within String
365
Table
368
Add to Table
368
First-In-First-Out and Last-In-First-Out
370
Memory Fill
372
Table Find
373
Timer
377
Timer Instructions
377
Timer Programming Tips and Examples
380
Interval Timers
386
Subroutine
388
CALL (Subroutine) and RET (Conditional Return)
388
8 Communication
395
CPU Communication Connections
396
CPU Communication Ports
397
Hmis and Communication Drivers
398
Ethernet
400
Overview
400
Local/Partner Connection
400
Sample Ethernet Network Configurations
401
Assigning Internet Protocol (IP) Addresses
402
Assigning IP Addresses to Programming and Network Devices
402
Configuring or Changing an IP Address for a CPU or Device in Your Project
404
Searching for Cpus and Devices on Your Ethernet Network
412
Locating the Ethernet (MAC) Address on the CPU
413
HMI-To-CPU Communication
415
Open User Communication
417
Protocols
417
Connections
418
Ports and Tsaps
419
Profibus
421
EM DP01 PROFIBUS DP Module
423
Distributed Peripheral (DP) Standard Communications
423
Using the EM DP01 to Connect an S7-200 SMART as a DP Device
424
Configuring the EM DP01
426
Data Consistency
427
Supported Configurations
428
Installing the EM DP01 GSD File
429
Configuring the EM DP01 I/O
431
Example of V Memory and I/O Address Area
433
User Program Considerations
435
LED Status Indicators for the EM DP01 PROFIBUS DP
437
Using Hmis and S7-Cpus with the EM DP01
439
Device Database File: GSD
440
PROFIBUS DP Communications to a CPU Example Program
444
Reference to the EM DP01 PROFIBUS DP Module Technical Specifications
446
PPI Protocol
447
Baud Rate and Network Address
448
Definition of Baud Rate and Network Address
448
Setting the Baud Rate and Network Address for the S7-200 SMART CPU
449
Sample RS485 Network Configurations
451
Single-Master PPI Networks
451
Multi-Master and Multi-Slave PPI Networks
451
Assigning RS485 Addresses
452
Configuring or Changing an RS485 Address for a CPU or Device in Your Project
452
Searching for Cpus and Devices on Your RS485 Network
457
Building Your Network
458
General Guidelines
458
Determining the Distances, Transmission Rates, and Cable Lengths for Your Network
459
Repeaters on the Network
459
Specifications for RS485 Cable
460
Connector Pin Assignments
460
Biasing and Terminating the Network Cable
462
Biasing and Terminating the CM01 Signal Board
463
Using HMI Devices on Your RS485 Network
464
Freeport Mode
465
Creating User-Defined Protocols with Freeport Mode
465
Using the RS232/PPI Multi-Master Cable and Freeport Mode with RS232 Devices
468
Rs232
470
9 Libraries
471
Library Types (Siemens and User-Defined)
471
Overview of Modbus Communication
473
Modbus Addressing
473
Modbus Read and Write Functions
475
Modbus RTU Library
476
Modbus Communication Overview
476
Modbus RTU Library Features
476
Requirements for Using Modbus Instructions
477
Initialization and Execution Time for Modbus Protocol
478
Modbus RTU Master
479
Using the Modbus RTU Master Instructions
479
MBUS_CTRL / MB_CTRL2 Instruction (Initialize Master)
481
MBUS_MSG / MB_MSG2 Instruction
483
Modbus RTU Master Execution Error Codes
487
Modbus RTU Slave
489
Using the Modbus RTU Slave Instructions
489
MBUS_INIT Instruction (Initialize Slave)
491
MBUS_SLAVE Instruction
492
Modbus RTU Slave Execution Error Codes
493
Modbus RTU Master Example Program
494
Modbus RTU Advanced User Information
496
Open User Communication Library
498
Parameters Common to the OUC Library Instructions
499
Open User Communication Library Instructions
501
TCP_CONNECT Instruction
501
ISO_CONNECT Instruction
504
UDP_CONNECT Instruction
508
TCP_SEND Instruction
510
TCP_RECV Instruction
513
UDP_SEND Instruction
516
UDP_RECV Instruction
519
DISCONNECT Instruction
522
Open User Communication Library Instruction Error Codes
524
Open User Communication Library Example
525
Active Partner (Client)
526
Checkerrors Subroutine
535
Active Partner Symbol Table
536
Passive Partner (Server)
537
Checkerrors Subroutine
543
Passive Partner Symbol Table
544
USS Library
545
USS Communication Overview
545
USS Protocol Overview
545
Requirements for Using the USS Protocol
546
Calculating the Time Required for Communicating with the Drive
547
USS Program Instructions
548
Using the USS Protocol Instructions
548
USS_INIT Instruction
549
USS_CTRL Instruction
551
Uss_Rpm_X Instruction
554
Uss_Wpm_X Instruction
557
USS Protocol Execution Error Codes
560
USS Protocol Example Program
561
Creating a User-Defined Library of Instructions
563
10 Debugging and Troubleshooting
565
Debugging Your Program
565
Bookmark Functions
565
Cross Reference Table
566
Displaying Program Status
568
Displaying Status in the Program Editor
568
Configuring the STL Status Options
571
Using a Status Chart to Monitor Your Program
572
Forcing Specific Values
574
Writing and Forcing Outputs in STOP Mode
575
How to Execute a Limited Number of Scans
576
Hardware Troubleshooting Guide
578
11 PID Loops and Tuning
581
PID Loop Definition Table
582
Prerequisites
586
Auto-Hysteresis and Auto-Deviation
586
Auto-Tune Sequence
587
Exception Conditions
589
Notes Concerning PV Out-Of-Range (Result Code 3)
590
PID Tune Control Panel
590
12 Open Loop Motion Control
595
Using the PWM Output
596
Configuring the PWM Output
596
Pwmx_Run Subroutine
598
Using Motion Control
599
Maximum and Start/Stop Speeds
599
Entering the Acceleration and Deceleration Times
600
Configuring the Motion Profiles
601
Features of Motion Control
604
Programming an Axis of Motion
606
Configuring an Axis of Motion
607
Subroutines Created by the Motion Wizard for the Axis of Motion
620
Guidelines for Using the Motion Subroutines
621
Axisx_Ctrl Subroutine
622
Axisx_Man Subroutine
623
Axisx_Goto Subroutine
625
Axisx_Run Subroutine
626
Axisx_Rseek Subroutine
627
Axisx_Ldoff Subroutine
628
Axisx_Ldpos Subroutine
629
Axisx_Srate Subroutine
630
Axisx_Dis Subroutine
631
Axisx_Cfg Subroutine
632
Axisx_Cache Subroutine
633
Axisx_Rdpos Subroutine
634
Axisx_Abspos Subroutine
635
Using the Axisx_Abspos Subroutine to Read the Absolute Position from a SINAMICS Servo Drive
637
Axisx_Abspos and Axisx_Ldpos Subroutines Usage Examples
637
Interconnections
638
Commissioning
639
Control Mode
639
Setpoint Pulse Input Channel
639
Setpoint Pulse Train Input Format
639
Common Engineering Units Basis
639
Important Facts to Know
642
Axis of Motion Example Programs
643
Axis of Motion Simple Relative Move (Cut-To-Length Application) Example
643
Axis of Motion Axisx_Ctrl, Axisx_Run, Axisx_Seek, and Axisx_Man Example
645
Monitoring the Axis of Motion
649
Displaying and Controlling the Operation of the Axis of Motion
651
Displaying and Modifying the Configuration of the Axis of Motion
656
Displaying the Profile Configuration for the Axis of Motion
656
Error Codes for the Axis of Motion (WORD at SMW620, SMW670, or SMW720)
658
Error Codes for the Motion Instruction (Seven LS Bits of SMB634, SMB684, or SMB734)
659
Advanced Topics
661
Understanding the Configuration/Profile Table for the Axis of Motion
661
Special Memory (SM) Locations for the Axis of Motion
670
Understanding the RP Seek Modes of the Axis of Motion
673
Selecting the Work Zone Location to Eliminate Backlash
678
Technical Specifications
679
General Specifications
679
General Technical Specifications
679
A.1 General Specifications
679
S7-200 SMART Cpus
685
CPU ST20, CPU SR20, and CPU Cr20S
685
General Specifications and Features
685
Digital Inputs and Outputs
689
Wiring Diagrams
692
A.2.1.3 Wiring Diagrams
692
CPU ST30, CPU SR30, and CPU Cr30S
695
General Specifications and Features
695
Digital Inputs and Outputs
698
Wiring Diagrams
701
A.2.2.3 Wiring Diagrams
701
CPU ST40, CPU SR40, and CPU Cr40S
704
General Specifications and Features
704
Digital Inputs and Outputs
708
Wiring Diagrams
711
A.2.3.3 Wiring Diagrams
711
CPU ST60, CPU SR60, and CPU Cr60S
714
General Specifications and Features
714
Digital Inputs and Outputs
718
Wiring Diagrams
721
A.2.4.3 Wiring Diagrams
721
Wiring Diagrams for Sink and Source Input, and Relay Output
724
Digital Inputs and Outputs Expansion Modules (Ems)
725
EM DE08 and EM DE16 Digital Input Specifications
725
EM DT08, EM DR08, EM QR16, and EM QT16 Digital Output Specifications
727
EM DT16, EM DR16, EM DT32, and EM DR32 Digital Input/Output Specifications
732
Analog Inputs and Outputs Expansion Modules (Ems)
738
EM AE04 and EM AE08 Analog Input Specifications
738
EM AQ02 and EM AQ04 Analog Output Module Specifications
741
EM AM03 and EM AM06 Analog Input/Output Module Specifications
744
Step Response of the Analog Inputs
748
Sample Time and Update Times for the Analog Inputs
749
Measurement Ranges of the Analog Inputs for Voltage and Current (SB and EM)
749
Measurement Ranges of the Analog Outputs for Voltage and Current (SB and EM)
750
Thermocouple and RTD Expansion Modules (Ems)
752
Thermocouple Expansion Modules (Ems)
752
EM AT04 Thermocouple Specifications
752
RTD Expansion Modules (Ems)
758
Digital Signal Boards
763
SB DT04 Digital Input/Output Specifications
763
Analog Signal Boards
767
SB AE01 Analog Input Specifications
767
SB AQ01 Analog Output Specifications
769
RS485/RS232 Signal Boards
771
SB RS485/RS232 Specifications
771
Battery Board Signal Boards (Sbs)
773
SB BA01 Battery Board
773
EM DP01 PROFIBUS DP Module
775
S7-200 SMART Cpus that Support the EM DP01 PROFIBUS DP Module
776
Connector Pin Assignments for EM DP01
777
EM DP01 PROFIBUS DP Module Wiring Diagram
778
S7-200 SMART Cables
779
S7-200 SMART I/O Expansion Cable
779
RS-232/PPI Multi-Master Cable and USB/PPI Multi-Master Cable
780
Overview
780
RS-232/PPI Multi-Master Cable
781
USB/PPI Multi-Master Cable
784
Calculating a Power Budget
787
Power Budget
787
B.1 Power Budget
787
Calculating a Sample Power Requirement
789
Calculating Your Power Requirement
790
Error Codes
791
Timestamp Mismatch
791
C.1 Timestamp Mismatch
791
PLC Non-Fatal Error Codes
792
PLC Non-Fatal Error SM Flags
795
PLC Fatal Error Codes
796
Special Memory (SM) and System Symbol Names
799
SM (Special Memory) Overview
799
SMB0: System Status
802
SMB1: Instruction Execution Status
803
SMB2: Freeport Receive Character
804
SMB3: Freeport Character Error
804
SMB4: Interrupt Queue Overflow, Run-Time Program Error, Interrupts Enabled, Freeport Transmitter Idle, and Value Forced
805
SMB5: I/O Error Status
805
SMB6-SMB7: CPU ID, Error Status, and Digital I/O Points
806
SMB8-SMB19: I/O Module ID and Errors
807
SMW22-SMW26: Scan Times
808
SMB28-SMB29: Signal Board ID and Errors
808
SMB30: (Port 0) and SMB130: (Port 1)
809
SMB34-SMB35: Time Intervals for Timed Interrupts
809
SMB36-SMB45 (HSC0), SMB46-SMB55 (HSC1), SMB56-SM65 (HSC2), SMB136-SMB145 (HSC3), SMB146-SMB155 (HSC4), SMB156-SMB165 (HSC5): High-Speed Counters
810
SMB66-SMB85 (PTO0/PWM0, PTO1/PWM1), SMB166-SMB169 (PTO0), SMB176-SMB179 (PTO1), and SMB566-SMB579 (PTO2/PWM2): High-Speed Outputs
816
SMB86-SMB94 and SMB186-SMB194: Receive Message Control
819
SMW98: Expansion I/O Bus Communication Errors
821
SMW100-SMW114 System Alarms
822
SMB130: Freeport Control for Port 1 (See SMB30)
823
SMB146-SMB155 (HSC4) and SMB156-SMB165 (HSC5)
823
SMB186-SMB194: Receive Message Control (See SMB86-SMB94)
823
SMB480-SMB515: Data Log Status
823
SMB600-SMB749: Axis (0, 1, and 2) Open Loop Motion Control
824
SMB650-SMB699: Axis 1 Open Loop Motion Control (See SMB600-SMB740)
825
SMB700-SMB749: Axis 2 Open Loop Motion Control (See SMB600-SMB740)
825
SMB1000-SMB1049: CPU Hardware/Firmware ID
826
SMB1050-SMB1099: SB (Signal Board) Hardware/Firmware ID
826
SMB1100-SMB1399: EM (Expansion Module) Hardware/Firmware ID
827
SMB1400-SMB1699: EM (Expansion Module) Module-Specific Data
830
References
831
Often-Used Special Memory Bits
831
E.1 Often-Used Special Memory Bits
831
Interrupt Events in Priority Order
832
High-Speed Counter Summary
833
STL Instructions
834
E.4 STL Instructions
834
Memory Ranges and Features
841
Ordering Information
843
CPU Modules
843
F.1 CPU Modules
843
Expansion Modules (Ems) and Signal Boards (Sbs)
844
Programming Software
844
Communication
845
Spare Parts and Other Hardware
845
F.4 Communication
845
Human Machine Interface Devices
847
Index
849
Other manuals for Siemens SIMATIC S7
Manual
336 pages
Functional Safety Manual
212 pages
User Guide
134 pages
Configuration And Programming Manual
70 pages
Operating Instructions
82 pages
Equipment Manual
52 pages
Product Information
28 pages
Related product manuals
Siemens SIMATIC S7 F
354 pages
Siemens Simatic S7-400
206 pages
Siemens Simatic S7-300
594 pages
Siemens SIMATIC S7-200
75 pages
Siemens SIMATIC S7-1200
364 pages
Siemens Simatic S7-1500
188 pages
Siemens Simatic S7 Series
75 pages
Siemens SIMATIC S5 Series
108 pages
Siemens SIMATIC S7-300 Series
192 pages
Siemens Simatic S7-200 CPU 210
140 pages
SIMATIC S7-300 Module data
594 pages
SIMATIC S7-1500 Automation System
208 pages