INDUSTRIAL AUTOMATION TRAINING
SIEMENS S7-300 PROGRAMMING IN STATEMENT LIST
PAGE 1
CONTENTS:
PAGE NO
1.
STEP7 OVERVIEW
3
2.
COMPARISON OF CPU's AND MODULES AVAILABLE
7
3.
ADDRESSING OF MODULES
9
4.
LOAD MEMORY AND WORK MEMORY
12
5.
BLOCKS IN THE USER PROGRAM
13
6.
DATA TYPES
14
7.
STATEMENT LIST PROGRAMMING
16
8.
BIT LOGIC INSTRUCTIONS
23
9.
COMPARISON INSTRUCTIONS
27
10.
CONVERSION INSTRUCTIONS
29
11.
COUNTER INSTRUCTIONS
38
12.
DATA BLOCK AND LOGIC CONTROL INSTRUCTIONS
45
13.
LOAD AND TRANSFER INSTRUCTIONS
48
14.
FLOATING POINT MATH INSTRUCTIONS
49
15.
INTEGER MATH INSTRUCTIONS
51
16.
PROGRAM CONTROL INSTRUCTIONS
54
17.
SHIFT INSTRUCTIONS
56
18.
TIMER INSTRUCTIONS
58
19.
WORD LOGIC INSTRUCTIONS
71
20.
ACCUMULATOR INSTRUCTIONS
73
21.
PROGRAMMING EXAMPLES
75
22.
GLOSSARY
86
PAGE 2
SIMATIC S7
PLC
RANGE
S7-400
HIGH END RANGE/MEDIUM RANGE
S7-300
MID AND LOW END PERFORMANCE RANGE MICRO PLC'S
S7-200 SIMATIC S7-300 COMPONENTS
S.No.
COMPONENT
FUNCTION
1.
Rail
Accomodates the S7-300 modules
2.
Power Supply (PS)
Converts the power system voltage (120/230VAC) into 24VDC for the S7-300 and load power supply for 24 VDC load circuits.
3.
CPU
Executes the user program, provides the 5V supply For the S7-300 backplane bus, communicates communicates with other CPU's or with a programming device via the MPI(Multi Point Interface).
4.
Signal Modules(SM)DI,DO,AI,AO
Match different process signal levels to the internal signal level of S7-300
5.
Function Modules (FMs)
For titime critical and memory intensive process signal processing tasks eg. Closed loop control
6.
Communication Processor (CP)
Relieves the CPU of communication tasks eg-CP 342-5 DP for connection to SINEC L2-DP.
7.
Interface Module(IM)
Interconnects the individual tiers of an an S7-300
8.
Sinec L2 cable with LAN connector
Interconnects CPUs and PCs
9.
Programmer Cable
Connects a CPU to a programming device
10. 10.
RS 485 485 Repea Repeater ter
Interf Interface aces s the S7-30 S7-300 0 over over large large dista distance nces s to other other S7300s or programming devices
PAGE 3
Overview of STEP 7 What is STEP 7? STEP 7 is the standard software package used for configuring and programming programming SIMATIC programmable logic controllers. It is part of the SIMATIC industry software. •
Basic Tasks When you create an automation solution with STEP 7, there are a series of basic tasks. The following figure shows the tasks that need to be performed for most projects and assigns them to a basic procedure.
Alternative Procedures Procedures As shown in the figure above, you have two alternative procedures: You can configure the hardware first and then program the blocks. You can, however, program the blocks first without configuring the hardware. This is recommended for service and maintenance work, for example, to integrate programmed blocks into in an existing project. • •
PAGE 4
Brief Description of the Individual Steps Installation and authorization The first time you use STEP 7, install it and transfer the authorization authorization from diskette to the hard disk Plan your controller Before you work with STEP 7, plan your automation solution from dividing the process into individual tasks to creating a configuration diagram Design the program structure Turn the tasks described in the draft of your controller design into a program structure using the blocks available in STEP 7 Start STEP 7 You start STEP 7 from the Windows 95/98/NT user interface Create a project structure A project is like a folder in which all data are stored in a hierarchical structure and are available to you at any time. t ime. After you have created a project, all other tasks are executed in this project Configure a station When you configure the station you specify the programmable controller you want to use; for example, SIMATIC 300, SIMATIC 400 Configure hardware When you configure the hardware you specify in a configuration table which modules you want to use for your automation solution and which addresses are to be used to access the modules from the user program. The properties of the modules can also be assigned using Configure networks and communication connections The basis for communication is a pre-configured network. For this, you will need to create the subnets required for your automation networks, set the subnet properties, and set the network connection properties and any communication connections connections required for the networked stations Define symbols You can define local or shared symbols, which have more descriptive names, in a symbol table to use instead of absolute addresses in your user program Create the program Using one of the available programming languages languages create a program linked to a module or independent independent of a module and store it as blocks, source files, or charts S7 only: generate and evaluate reference data You can make use of these reference data to make debugging and modifying your user program easier Configure messages You create block-related messages, for example, with their texts and attributes. Using the transfer program you transfer the message configuration data created to the operator interface system database (for example, example, SIMATIC WinCC, SIMATIC ProTool) Configure operator control and monitoring variables You create operator control and monitoring variables once in STEP 7 and assign them the required attributes. Using the transfer program you transfer the operator control and monitoring variables variables created to the database of the operator interface system WinCC Download programs to the programmable controller S7 only: after all configuration, parameter assignment, and programming tasks are completed, completed, you can download your entire user program or individual blocks from it to the programmable programmable controller (programmable (programmable module for your hardware solution). Test programs S7 only: for testing you can either display the values of variables from your user program or a CPU, assign values to the variables, and create a variable table for the variables that you want to display or modify Monitor operation, diagnose hardware You determine the cause of a module fault by displaying online information about a module. You determine the causes for errors in user program processing with the help of the diagnostic buffer and the stack contents. You can also check whether a user program can run on a particular CPU Document the plant After you have created a project/plant, it makes sense to produce clear documentation of the project data to make further editing of the project and any service activities easier •
•
•
•
•
•
•
•
•
•
•
•
•
•
•
PAGE 5
COMPARISON OF CPU'S CPU's
CPU312IFM
Mem Statement/Bytes Memory Cards
2K/6KB -
Processing Time 1024 Statements DI & DO Max AI & AO Max Rack Configuration Expansion Modules Max Bit Memories Counters Timers MPI Interface 187.5 Kbit/s Max 32 Nodes Integrated functions+Interfaces
CPU313
CPU314IFM
0.6 ms
4K/12KB 512KB FEPROM 0.6 ms
0.3 ms
16K/48KB 512KB FEPROM 0.3 ms
256 64 1-Tier 8 1024 32 64 Yes
256 64 1-Tier 8 2048 32 64 Yes
1024 256 4-Tier 31 2048 64 72 Yes
1024 256 4-Tier 31 2048 64 128 Yes
10DI/6DQ onboard. int. functions:Count ers/Freq. Measuremensts
-
20DI/16DQ , 4AI,1AO onboard. int. functions:Co unters/Freq. Measuremen sts/Positionin g PID Control
-
CPU's
CPU315
CPU315-2DP
CPU316-2DP
CPU318-2
Mem Statement/Bytes Memory Cards
16K/48KB 512KB FEPROM
16K/48KB 512KB FEPROM 0.3 ms
42K/128KB 4MB FEPROM 0.3 ms
256KB 4MB FEPROM
Processing Time 1024 0.3 ms Statements DI & DO Max 1024 AI & AO Max 256 Rack Configuration 4-Tier Expansion Modules Max 32 Bit Memories 2048 Counters 64 Timers 128 MPI Interface Yes 187.5 Kbit/s Max 32 Nodes Integrated functions+Interfaces
2048 256 4-Tier 32 2048 64 128 Yes
8K/24KB -
CPU314
4096 256 4-Tier 32 2048 64 128 Yes
PROFIBUSDP Master/Slave (64 DP stations,12M baud)
PROFIBUSDP Master/Slave (64 DP stations,12M baud)
0.1 ms 16384 1024 4-Tier 32 8192 512 512 Upto 12Mbaud
PROFIBUS-DP Master/Slave (125 DP stations,12Mb aud)
* 1 K statements correspond correspond to approx. 3Kbytes of user memory.
PAGE 6
THE DIFFERENT TYPES OF MODULES AVAILABLE ARE 1. SIGNAL SIGNAL MODULES MODULES - FOR DIGITAL DIGITAL AND ANALOG ANALOG SIGNALS SIGNALS
DIGITAL INPUTS • • • •
16 X 24 VDC 8 X 120 / 230 VAC 16 X 120 V AC 32 X 24 V DC
DIGITAL OUTPUTS • • • • •
16 x 24 VDC ,0.5A 8 X 24 VDC ,2A 8 X 120 / 230 VAC, 2A 16 X 120 VAC, 1A 32 X 24 V DC, 0.5A
RELAY OUTPUTS • • • •
8 X Relay 30 VDC ,0.5A 8 X Relay 250 VAC ,3A 16 X Relay 30VDC,0.5A 16 X Relay 120VAC, 2.5A
DI/DO MODULES •
ANAL NALOG INPU INPUTS TS PARA PARAM METER ETERIZ IZAB ABL LE • •
8 Analog Inputs/ 2 Analog Inputs +/- 10V , +/- 50 mV, +/-1 V, +/-20 Ma, 4 to 20mA, Pt100, Thermocouple
8DI/8DO X 24VDC 0.5A
ANA ANALOG OUTPU UTPUT TS PAR PARAMET AMETER ERIZ IZA ABLE BLE • •
4 Analog Outputs/ 2 Analog Outputs +/-10V, +/-50mV, +/-1 V, +/-20 mV, 4 to 20 mA
2. FUNC FUNCTI TION ON MODUL ODULES ES High Speed Counter Modules - Upto 100 KHz range Positioning Modules Modules - For position control, Stepper Motor Control, Cam Controllers • •
All function modules are enclosed and can be installed in any slot. 3. COMMUNICA COMMUNICATION TION PROCESS PROCESSORS ORS - FOR DATA EXCHAN EXCHANGE GE WITH PRINTERS PRINTERS,COM ,COMPUTE PUTERS, RS, SIMATIC SYSTEMS CP340 - Point to Point Communication for the serial link with RS232, 3964R and any ASCII protocol •
4. INTERFACE INTERFACE MODULES MODULES - FOR MULTI MULTI TIER TIER CONFIGU CONFIGURATI RATION ON For Central Controller Expansion For Expansion Unit Connection • •
5. POWER POWER SUPPLY SUPPLY MODULES MODULES - FOR 24 24 VDC LOAD LOAD CIRCUITS CIRCUITS WITH WITH DIFFERENT DIFFERENT RATING RATINGS. S.
MPI - MULTI POINT INTERFACE FOR COMMUNICATION • • •
•
MPI INTEGRATED IN CPU DATA EXCHANGE RATE : 187.5 Kbits / s SIMULTANEOUS COMMUNICATION COMMUNICATION WITH PG/PC/OP(OPERATOR PG/PC/OP(OPERATOR PANEL) AND FURTHER FURTHER PLCS REQUIRING NO ADDITIONAL HARDWARE UPTO 32 NODES CAN BE CONNECTED
PAGE 7
ADDRESSING OF MODULES
Slot Addressing for Rack 0
RACK 0
CPU
4
5
6
7
8
9
10
11
Digital Address
0
4
8
12
16
20
24
28
Analog Address
256
272
288
304
320
336
352
368
Slot Number
1
2
3
Module Starting Addresses of the Signal Modules on Rack 0
Slot Addressing for Rack 1 CPU
IM
AI / AO / DI / DO Modules
RACK 1
Slot Number
4
5
6
7
8
9
10
11
Digital Address
64 32
36
40
44
48
52
56
60
Analog Address
512 384
400
416
432
448
464
480
496
3
Module Starting Addresses of the Signal Modules on Rack 1
PAGE 8
Slot Addressing for Rack 2
RACK 2
Slot Number
4
5
6
7
8
9
10
11
Digital Address
64
68
72
76
80
84
88
92
Analog Address
512
528
544
560
576
592
608
624
3
Module Starting Addresses of the Signal Modules on Rack 2
Slot Addressing for Rack 3 CPU
IM
AI / AO / DI / DO Modules
RACK 3
Slot Number
4
5
6
7
8
9
10
11
Digital Address
64 96
100
104
108
112
116
120
124
Analog Address
512 640
656
672
688
704
720
736
752
3
Module Starting Addresses of the Signal Modules on Rack 3
PAGE 9