SlideShare une entreprise Scribd logo
1  sur  98
Télécharger pour lire hors ligne
AUTOMATION TRAINING
of
SIEMENS
S7-300 PROGRAMMING
CONTENTS: PAGE NO
1. STEP7 OVERVIEW 4
2. COMPARISON OF CPU's AND MODULES AVAILABLE 8
3. ADDRESSING OF MODULES 10
4. LOAD MEMORY AND WORK MEMORY 12
5. BLOCKS IN THE USER PROGRAM 14
6. DATA TYPES 15
7. STATEMENT LIST PROGRAMMING 17
8. BIT LOGIC INSTRUCTIONS 24
9. COMPARISON INSTRUCTIONS 28
10.CONVERSION INSTRUCTIONS 30
11.COUNTER INSTRUCTIONS 39
12.DATA BLOCK AND LOGIC CONTROL INSTRUCTIONS 46
13.LOAD AND TRANSFER INSTRUCTIONS 49
14.FLOATING POINT MATH INSTRUCTIONS 50
15.INTEGER MATH INSTRUCTIONS 52
16.PROGRAM CONTROL INSTRUCTIONS 55
17.SHIFT INSTRUCTIONS 57
18.TIMER INSTRUCTIONS 59
19.WORD LOGIC INSTRUCTIONS 72
20.ACCUMULATOR INSTRUCTIONS 74
21.PROGRAMMING EXAMPLES 76
22.GLOSSARY 87
SIMATIC S7
PAGE 2
PLC RANGE
S7-400 HIGH END RANGE/MEDIUM RANGE
S7-300 MID AND LOW END PERFORMANCE
RANGE
S7-200 MICRO PLC'S
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 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 time 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 S7-300
8. Sinec L2 cable with LAN
connector
Interconnects CPUs and PCs
9. Programmer Cable Connects a CPU to a programming device
10. RS 485 Repeater Interfaces the S7-300 over large distances to other S7-
300s 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
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
As shown in the figure above, you have two alternative procedures:
PAGE 4
• 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.
Brief Description of the Individual Steps
• Installation and authorization
The first time you use STEP 7, install it and transfer the 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. 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 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 create a program linked to a module or
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, 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 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, you can download your entire user program or individual blocks from it to the
programmable controller (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
PAGE 5
• 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 6
COMPARISON OF CPU'S
CPU's CPU312IFM CPU313 CPU314IFM CPU314
Mem Statement/Bytes 2K/6KB 4K/12KB 8K/24KB 16K/48KB
Memory Cards - 512KB
FEPROM
- 512KB
FEPROM
Processing Time 1024
Statements
0.6 ms 0.6 ms 0.3 ms 0.3 ms
DI & DO Max 256 256 1024 1024
AI & AO Max 64 64 256 256
Rack Configuration 1-Tier 1-Tier 4-Tier 4-Tier
Expansion Modules Max 8 8 31 31
Bit Memories 1024 2048 2048 2048
Counters 32 32 64 64
Timers 64 64 72 128
MPI Interface
187.5 Kbit/s
Max 32 Nodes
Yes Yes Yes Yes
Integrated
functions+Interfaces
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 16K/48KB 16K/48KB 42K/128KB 256KB
Memory Cards 512KB FEPROM 512KB
FEPROM
4MB
FEPROM
4MB FEPROM
Processing Time 1024
Statements
0.3 ms 0.3 ms 0.3 ms 0.1 ms
DI & DO Max 1024 2048 4096 16384
AI & AO Max 256 256 256 1024
Rack Configuration 4-Tier 4-Tier 4-Tier 4-Tier
Expansion Modules Max 32 32 32 32
Bit Memories 2048 2048 2048 8192
Counters 64 64 64 512
Timers 128 128 128 512
MPI Interface
187.5 Kbit/s
Max 32 Nodes
Yes Yes Yes Upto 12Mbaud
Integrated
functions+Interfaces
- PROFIBUS-
DP
Master/Slave
(64 DP
stations,12M
baud)
PROFIBUS-
DP
Master/Slave
(64 DP
stations,12M
baud)
PROFIBUS-DP
Master/Slave
(125 DP
stations,12Mb
aud)
PAGE 7
* 1 K statements correspond to approx. 3Kbytes of user memory.
PAGE 8
THE DIFFERENT TYPES OF MODULES AVAILABLE ARE
1. SIGNAL MODULES - FOR DIGITAL AND ANALOG SIGNALS
DIGITAL INPUTS DIGITAL OUTPUTS
• 16 X 24 VDC
• 8 X 120 / 230 VAC
• 16 X 120 V AC
• 32 X 24 V DC
• 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 DI/DO MODULES
• 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
• 8DI/8DO X 24VDC 0.5A
ANALOG INPUTS PARAMETERIZABLE ANALOG OUTPUTS PARAMETERIZABLE
• 8 Analog Inputs/ 2 Analog Inputs
• +/- 10V , +/- 50 mV, +/-1 V, +/-20 Ma, 4 to
20mA, Pt100, Thermocouple
• 4 Analog Outputs/ 2 Analog Outputs
• +/-10V, +/-50mV, +/-1 V, +/-20 mV, 4 to 20
mA
2. FUNCTION MODULES
• High Speed Counter Modules - Upto 100 KHz range
• Positioning Modules - For position control, Stepper Motor Control, Cam Controllers
All function modules are enclosed and can be installed in any slot.
3. COMMUNICATION PROCESSORS - FOR DATA EXCHANGE WITH PRINTERS,COMPUTERS,
SIMATIC SYSTEMS
• CP340 - Point to Point Communication for the serial link with RS232, 3964R and any ASCII
protocol
4. INTERFACE MODULES - FOR MULTI TIER CONFIGURATION
• For Central Controller Expansion
• For Expansion Unit Connection
5. POWER SUPPLY MODULES - FOR 24 VDC LOAD CIRCUITS WITH DIFFERENT RATINGS.
MPI - MULTI POINT INTERFACE FOR COMMUNICATION
• MPI INTEGRATED IN CPU
• DATA EXCHANGE RATE : 187.5 Kbits / s
PAGE 9
MUMBAI-64 TEL.: 022-8883737
• SIMULTANEOUS COMMUNICATION WITH PG/PC/OP(OPERATOR PANEL) AND FURTHER
PLCS REQUIRING NO ADDITIONAL HARDWARE
• UPTO 32 NODES CAN BE CONNECTED
ADDRESSING OF MODULES
MUMBAI OFF: 43, DATTANI CHAMBERS, NEAR NEW ERA THEATRE, S.V. ROAD, MALAD(W)
Slot Addressing for Rack 0
•
CPU
RACK 0
Slot Number 1 2 3
Digital Address
Analog Address
4
0
256
PS
5
4
272
11
28
368
10
24
352
9
20
336
8
16
320
7
12
304
6
8
288
Module Starting Addresses of the Signal Modules on Rack 0
Slot Addressing for Rack 1
4
64
512
4
32
384
6
40
416
7
44
432
8
48
448
9
52
464
10
56
480
11
60
496
5
36
400
RACK 1
Slot Number 3
Digital Address
Analog Address
CPU IM AI / AO / DI / DO Modules
Module Starting Addresses of the Signal Modules on Rack 1
PAGE 11
CPU IM AI / AO / DI / DO Modules
Slot Addressing for Rack 3
Module Starting Addresses of the Signal Modules on Rack 3
RACK 3
Slot Number 3
Digital Address
Analog Address
5
100
656
11
124
752
10
120
736
9
116
720
8
112
704
7
108
688
6
104
672
4
64
512
4
96
640
Slot Addressing for Rack 2
Module Starting Addresses of the Signal Modules on Rack 2
RACK 2
Slot Number 3
Digital Address
Analog Address
5
68
528
11
92
624
10
88
608
9
84
592
8
80
576
7
76
560
6
72
544
4
64
512
4
64
512
PAGE 12
PUNE OFF: C-17,PAWANA IND. EST., T-204, MIDC - BHOSARI, PUNE-411026
Rack 0
4
CPU
Slot Number 1 2 (IM) 3
PS
1110
Rack 1
111098744
64Connecting cable 368
Slot Number IM 5 6
512
Rack 2
111098744
64Connecting cable 368
Slot Number IM 5 6
512
Rack 3
Slot Number IM 5 1110987644
64
512
98765
Load Memory and Work Memory in the CPU
After completing the configuration, parameter assignment, and program creation and establishing the
online connection, you can download complete user programs or individual blocks to a programmable
controller. To test individual blocks, you must download at least one organization block (OB) and the
function blocks (FB) and functions (FC) called in the OB and the data blocks (DB) used. To download
the system data created when the hardware was configured, the networks configured, and the
connection table created to the programmable controller, you download the object “System Data".
You download user programs to a programmable controller using the SIMATIC Manager, for example,
during the end phase of the program testing or to run the finished user program.
Relationship - Load Memory and Work Memory
The complete user program is downloaded to the load memory; the parts relevant to program
execution are also loaded into the work memory.
CPU Load Memory
• The load memory is used to store the user program without the symbol table and the
comments (these remain in the memory of the programming device).
• Blocks that are not marked as required for startup will be stored only in the load memory.
• The load memory can either be RAM, ROM, or EPROM memory, depending on the
programmable controller.
CPU Work Memory
The work memory (integrated RAM) is used to store the parts of the user program required for
program processing.
Possible Downloading/Uploading Procedures
You use the download function to download the user program or loadable objects (for example,
blocks) to the programmable controller. If a block already exists in the RAM of the CPU, you will be
prompted to confirm whether or not the block should be overwritten.
• You can select the loadable objects in the project window and download them from the
SIMATIC Manager (menu command: PLC > Download).
• When programming blocks and when configuring hardware and networks you can directly
download the object you were currently editing using the menu in the main window of the
application you are working with (menu command: PLC > Download).
• Another possibility is to open an online window with a view of the programmable controller (for
example, using View > Online or PLC > Display Accessible Nodes) and copy the object
you want to download to the online window.
Alternatively you can upload the current contents of blocks from the RAM load memory of the CPU to
your programming device via the load function.
PAGE 13
Blocks in the User Program
The STEP 7 programming software allows you to structure your user program, in other words to break
down the program into individual, self-contained program sections. This has the following advantages:
• Extensive programs are easier to understand.
• Individual program sections can be standardized.
• Program organization is simplified.
• It is easier to make modifications to the program.
• Debugging is simplified since you can test separate sections.
• Commissioning your system is made much easier.
The example of an industrial blending process illustrated the advantages of breaking down an
automation process into individual tasks. The program sections of a structured user program
correspond to these individual tasks and are known as the blocks of a program.
Block Types
There are several different types of blocks you can use within an S7 user program:
Block Brief Description Of Function
Organization blocks (OB) OBs determine the structure of the user program.
System function blocks (SFB)
and system functions (SFC)
SFBs and SFCs are integrated in the S7 CPU and allow you
access to some important system functions.
Function blocks (FB) FBs are blocks with a "memory" which you can program yourself.
Functions (FC) FCs contain program routines for frequently used functions.
Instance data blocks
(instance DB)
Instance DBs are associated with the block when an FB/SFB is
called. They are created automatically during compilation.
Data blocks (DB) DBs are data areas for storing user data. In addition to the data
that are assigned to a function block, shared data can also be
defined and used by any blocks.
OBs, FBs, SFBs, FCs, and SFCs contain sections of the program and are therefore also known as
logic blocks. The permitted number of blocks per block type and the permitted length of the blocks is
CPU-specific.
PAGE 14
DATA TYPES
Introduction to Data Types and Parameter Types
All the data in a user program must be identified by a data type. The following data types are
available:
• Elementary data types provided by STEP 7
• Complex data types that you yourself can create by combining elementary data types
• Parameter types with which you define parameters to be transferred to FBs or FCs
General Information
Statement List, Ladder Logic, and Function Block Diagram instructions work with data objects of
specific sizes. Bit logic instructions work with bits, for example. Load and transfer instructions (STL)
and move instructions (LAD and FBD) work with bytes, words, and double words.
A bit is a binary digit "0" or "1." A byte is made up of eight bits, a word of 16 bits, and a double word of
32 bits.
Math instructions also work with bytes, words, or double words. In these byte, word, or double word
addresses you can code numbers of various formats such as integers and floating-point numbers.
When you use symbolic addressing, you define symbols and specify a data type for these symbols
(see table below). Different data types have different format options and number notations.
This chapter describes only some of the ways of writing numbers and constants. The following table
lists the formats of numbers and constants that will not be explained in detail.
Format Size in Bits Number Notation
Hexadecimal 8, 16, and 32 B#16#, W#16#, and DW#16#
Binary 8, 16, and 32 2#
date 16 D#
time 32 T#
Time of day 32 TOD#
Character 8 'A'
Elementary Data Types
Each elementary data type has a defined length. The following table lists the elementary data types.
Type and
Description
Size
in
Bits
Format Options
Range and Number
Notation (lowest
to highest value)_
Example
BOOL(Bit)
Boolean text TRUE/FALSE TRUE
BYTE
(Byte)
8
Hexadecimal number
B16#0 to B16#FF
L B#16#10
L byte#16#10
WORD
(Word)
16
Binary number
Hexadecimal number
BCD
Decimal number unsigned
2. 0 to
2#1111_1111_1111_1111
W#16#0 to W#16#FFFF
C#0 to C#999
B#(0.0) to B#(255.255)
L 2#0001_0000_0000_0000
L W#16#1000
L word16#1000
L C#998
L B#(10,20)
L byte#(10,20)
DWORD 32 Binary number 2#0 to 2#1000_0001_0001_1000_
PAGE 15
(Double word)
Hexadecimal number
Decimal number unsigned
2#1111_1111_1111_1111
1111_1111_1111_1111
DW#16#0000_0000 to
DW#16#FFFF_FFFF
B#(0,0,0,0) to
B#(255,255,255,255)
1011_1011_0111_1111
L DW#16#00A2_1234
L dword#16#00A2_1234
L B#(1, 14, 100, 120)
L byte#(1,14,100,120)
INT
(Integer)
16 Decimal number signed -32768 to 32767 L 1
DINT
(Integer, 32 bits)
32 Decimal number signed
L#-2147483648 to
L#2147483647
L L#1
REAL
(Floating-point
number)
32
IEEE
Floating-point number
Upper limit: 3.402823e+38
Lower limit: 1.175 495e-38
L 1.234567e+13
S5TIME
(SIMATIC time)
16
S7 time in
steps of
10 ms (default)
S5T#0H_0M_0S_10MS to
S5T#2H_46M_30S_0MS
and
S5T#0H_0M_0S_0MS
L S5T#0H_1M_0S_0MS
L
S5TIME#0H_1H_1M_0S_0
MS
TIME
(IEC time)
32
IEC time in steps of 1 ms,
integer signed
-
T#24D_20H_31M_23S_64
8MS to
T#24D_20H_31M_23S_64
7MS
L T#0D_1H_1M_0S_0MS
L
TIME#0D_1H_1M_0S_0MS
DATE
(IEC date)
16 IEC date in steps of 1 day
D#1990-1-1 to
D#2168-12-31
L D#1996-3-15
L DATE#1996-3-15
TIME_OF_DAY
(Time)
32 Time in steps of 1 ms
TOD#0:0:0.0 to
TOD#23:59:59.999
L TOD#1:10:3.3
L TIME_OF_DAY#1:10:3.3
CHAR
(Character)
8 ASCII characters 'A','B' etc. L 'E'
Parameter Types
In addition to elementary and complex data types, you can also define parameter types for formal
parameters that are transferred between blocks. STEP 7 recognizes the following parameter types:
• TIMER or COUNTER: this specifies a particular timer or particular counter that will be used
when the block is executed. If you supply a value to a formal parameter of the TIMER or
COUNTER parameter type, the corresponding actual parameter must be a timer or a counter,
in other words, you enter "T" or "C" followed by a positive integer.
• BLOCK: specifies a particular block to be used as an input or output. The declaration of the
parameter determines the block type to be used (FB, FC, DB etc.). If you supply values to a
formal parameter of the BLOCK parameter type, specify a block address as the actual
parameter. Example: “FC101" (when using absolute addressing) or “Valve" (with symbolic
addressing).
Parameter Capacity Description
TIMER 2. Byte
s
Indicates a timer to be used by the program in the called logic block.
Format: T1
PAGE 16
COUNTER 2 bytes
Indicates a counter to be used by the program in the called logic block.
Format: C10
BLOCK_FB
BLOCK_FC
BLOCK_DB
BLOCK_SDB
2 bytes
Indicates a block to be used by the program in the called logic block.
Format: FC101
DB42
PAGE 17
PROGRAMMING IN STATEMENT LIST
What is Statement List?
Statement List (STL) is a textual programming language that can be used to create the code section
of logic blocks. Its syntax for statements is similar to assembler language and consists of instructions
followed by addresses on which the instructions act.
The Programming Language STL
Of all the programming languages with which you can program S7 controllers, STL is the closest to
the machine code MC7 of the S7 CPU. This means that by using it to program S7 controllers, you can
optimize the run time and the use of memory.
The programming language STL has all the necessary elements for creating a complete user
program. It contains a comprehensive range of instructions. A total of over 130 different basic
instructions and a wide range of addresses are available. Functions and function blocks allow you to
structure your STL program clearly.
The Programming Package
The STL programming package is an integral part of the STEP 7 Standard Software. This means that
following the installation of your STEP 7 software, all the editor functions, compiler functions and
test/debug functions for STL are available to you.
Using STL, you can create your own user program as follows:
_ With the Incremental Editor. The input of the local data structure is made easier with the help of
table editors.
_ With a source file in the Text Editor. Text input is made easier with the help of block templates.
There are three programming languages in the standard software, STL, FBD, and LAD. You can
switch from one language to the other almost without restriction and choose the most suitable
language for the particular block you are programming.
If you write programs in LAD or FBD, you can always switch over to the STL representation. If you
convert LAD programs into FBD programs and vice versa, program elements that cannot be
represented in the destination language are displayed in STL.
A STATEMENT CONSISTS OF AN INSTRUCTION AND AN ADDRESS
Address of an Instruction
The address of an instruction indicates a constant or the location where the instruction finds a value
(data object) on which to perform an operation. The address can have a symbolic name or an
absolute designation. The address can point to any of the following items :
_ A constant, the value of a timer or counter, or an ASCII character string to be loaded into
accumulator 1 (for example, L +27 See Table 2.1)
_ A bit in the status word of the programmable logic controller
_ A symbolic name (for example, A Motor.On, see Table 2-3)
_ A data block and a location within the data block area (for example, L DB4.DBD10, see Table 2-4)
_ A function (FC), function block (FB), integrated system function (SFC), or integrated system function
block (SFB) and the number of the function or block (see Table 2-5)
_ An address identifier and a location within the memory area that is indicated by the address
identifier (for example, A I 1.0)
PAGE 18
PAGE 19
PAGE 20PAGE 20
PAGE 21
PAGE 22
PAGE 23
PAGE 24
COMMANDS USED IN STATEMENT LIST
• Bit Logic Instructions
) Nesting Closed
= Assign
A And
A( And with Nesting Open
AN And Not
AN( And Not with Nesting Open
FN Edge Negative
FP Edge Positive
O Or
O And before Or
O( Or with Nesting Open
ON Or Not
ON( Or Not with Nesting Open
R Reset
S Set
PAGE 25
PAGE 26
•
PAGE 27
PAGE 28
Comparison Instructions
PAGE 29
`
PAGE 30
31
Conversion Instructions
AUTOMATION & CONTROL SYTEMS PAGE
PUNE OFF: C-17,PAWANA IND. EST., T-204, MIDC - BHOSARI, PUNE-411026
MUMBAI OFF: 43, DATTANI CHAMBERS, NEAR NEW ERA THEATRE, S.V. ROAD, MALAD(W)
MUMBAI-64 TEL.: 022-8883737
BTD BCD to Double Integer (32-Bit)
Example:
L MD10 Load the BCD number into ACCU 1.
BTD Convert from BCD to integer; store result in ACCU 1.
T MD20 Transfer result (double integer number) to MD20.
BTI BCD to Integer (16-Bit)
Example:
L MW10 Load the BCD number into ACCU 1-L.
BTI Convert from BCD to integer; store result in ACCU 1-L.
T MW20 Transfer result (integer number) to MW20.
CAD Change Byte Sequence in ACCU 1 (32-Bit)
Example:
L MD10 Load the value of MD10 into ACCU 1.
CAD Reverse the sequence of bytes in ACCU 1.
T MD20 Transfer the results to MD20.
Contents of ACCU 1 before execution of CAD:
ACCU 1-H-H: ACCU 1-H-L: ACCU 1-L-H: ACCU 1-L-L:
value "A" value "B" value "C" value "D"
Contents of ACCU 1 after execution of CAD:
ACCU 1-H-H: ACCU 1-H-L: ACCU 1-L-H: ACCU 1-L-L:
value "D" value "C" value "B" value "A"
PAGE 32
CAW Change Byte Sequence in ACCU 1-L (16-Bit)
Example:
L MW10 Load the value of MW10 into ACCU 1.
CAW Reverse the sequence of bytes in ACCU 1-L.
T MW20 Transfer the result to MW20.
Contents of ACCU 1 before execution of CAW:
ACCU 1-H-H: ACCU 1-H-L: ACCU 1-L-H: ACCU 1-L-L:
value "A" value "B" value "C" value "D"
Contents of ACCU 1 after execution of CAW:
ACCU 1-H-H: ACCU 1-H-L: ACCU 1-L-H: ACCU 1-L-L:
value "A" value "B" value "D" value "C"
DTB Double Integer (32-Bit) to BCD
Example:
L MD10 Load the 32-bit integer into ACCU 1.
DTB Convert from integer (32-bit) to BCD, store result in ACCU 1.
T MD20 Transfer result (BCD number) to MD20.
PAGE 33
DTR Double Integer (32-Bit) to Floating-Point Number (32-Bit, IEEE-FP)
Example:
L MD10 Load the 32-bit integer into ACCU 1.
DTR Convert from double integer to floating point (32-bit IEEE FP); store result in
ACCU 1.
T MD20 Transfer result (BCD number) to MD20.
INVD Ones Complement Double Integer (32-Bit)
Example:
Bit 31 16 15 0
Contents of ACCU 1
before execution of INVD 0110 1111 1000 1100 0110 0011 1010 1110
Contents of ACCU 1
after execution of INVD 1001 0000 0111 0011 1001 1100 0101 0001
L ID8 Load value into ACCU 1.
INVD Form ones complement (32-bit).
T MD10 Transfer result to MD10.
PAGE 34
INVI Ones Complement Integer (16-Bit)
Example:
Bit 15 0
Contents of ACCU 1-L before execution of INVI 0110 0011 1010 1110
Contents of ACCU 1-L after execution of INVI 1001 1100 0101 0001
L IW8 Load value into ACCU 1-L.
INVI Form ones complement 16-bit.
T MW10 Transfer result to MW10.
ITB Integer (16-Bit) to BCD
Example:
L MW10 Load the integer number into ACCU 1-L.
ITB Convert from integer to BCD (16-bit); store result in ACCU 1-L.
T MW20 Transfer result (BCD number) to MW20.
PAGE 35
ITD Integer (16-Bit) to Double Integer (32-Bit)
Example:
L MW12 Load the integer number into ACCU 1.
ITD Convert from integer (16-bit) to double integer (32-bit); store result in
ACCU 1.
T MD20 Transfer result (double integer) to MD20.
MW12 = "-10" (Integer, 16-bit):
ACCU 1-H ACCU 1-L
Bit: 31 16 : 15 0
Contents of ACCU 1 before execution of ITD: XXXX XXXX XXXX XXXX 1111 1111 1111 0110
Contents of ACCU 1 after execution of ITD: 1111 1111 1111 1111 1111 1111 1111 0110
(X = 0 or 1, bits are not used for conversion)
NEGD Twos Complement Double Integer (32-Bit)
Example:
ACCU 1-H ACCU 1-L
Bit: 31 .0
Contents of ACCU 1 before execution of NEGD: 0101 1111 0110 0100 0101 1101 0011 1000
Contents of ACCU 1 after execution of NEGD: 1010 0000 1001 1011 1010 0010 1100 1000
L ID8 Load value into ACCU 1.
NEGD Generate twos complement (32-bit).
T MD10 Transfer result to MD10.
PAGE 36
NEGI Twos Complement Integer (16-Bit)
Example:
Bit 15 0
Contents of ACCU 1-L before execution of NEGI0101 1101 0011 1000
Contents of ACCU 1-L after execution of NEGI 1010 0010 1100 1000
L IW8 Load value into ACCU 1-L.
NEGI Form twos complement 16-bit.
T MW10 Transfer result to MW10.
NEGR Negate Floating-Point Number (32-Bit, IEEE-FP)
Example:
L ID8 Load value into ACCU 1 (example: ID 8 = 1.5E+02).
NEGR Negate floating-point number (32-bit, IEEE-FP); stores the result in ACCU 1.
T MD10 Transfer result to MD10 (example: result = -1.5E+02).
PAGE 37
RND Round
Example:
L MD10 Load the floating-point number into ACCU 1-L.
RND Convert the floating-point number (32-bit, IEEE-FP) into an integer (32-bit)
and
round off the result.
T MD20 Transfer result (double integer number) to MD20.
Value before conversion: Value after conversion:
MD10 = "100.5" => RND => MD20 = "+100"
MD10 = "-100.5" => RND => MD20 = "-100"
PAGE 38
RND+ Round to Upper Double Integer
Example:
L MD10 Load the floating-point number (32-bit, IEEE-FP) into ACCU 1-L.
RND+ Convert the floating-point number (32-bit, IEEE-FP) to an integer (32-bit) and
round
result.Store output in ACCU 1.
T MD20 Transfer result (double integer number) to MD20.
Value before conversion: Value after conversion:
MD10 = "100.5" => RND+ => MD20 = "+101"
MD10 = "-100.5" => RND+ => MD20 = "-100"
RND- Round to Lower Double Integer
Example:
L MD10 Load the floating-point number into ACCU 1-L.
RND- Convert the floating-point number (32-bit, IEEE-FP) to an integer (32-bit) and
round
result.Store result in ACCU 1.
T MD20 Transfer result (double integer number) to MD20.
PAGE 39
Value before conversion: Value after conversion:
MD10 = "100.5" => RND- => MD20 = "+100"
MD10 = "-100.5" => RND- => MD20 = "-101"
TRUNC Truncate
Example:
L MD10 Load the floating-point number into ACCU 1-L.
TRUNC Convert the floating-point number (32-bit, IEEE-FP) to an integer (32-bit) and
round
result.Store the result in ACCU 1.
T MD20 Transfer result (double integer number) to MD20.
Value before conversion: Value after conversion:
MD10 = "100.5" => TRUNC => MD20 = "+100"
MD10 = "-100.5" => TRUNC => MD20 = "-100"
PAGE 40
• Counter Instructions
PAGE 41
PAGE 42PAGE 42
PAGE 43
PAGE 44
PAGE 45PAGE 45
PAGE 46PAGE 46
CD Counter Down
Example:
L C#14 Counter preset value.
A I 0.1 Preset counter after detection of rising edge of I 0.1.
S C1 Load counter 1 preset if enabled.
A I 0.0 One count down per rising edge of I 0.0.
CD C1 Decrement counter C1 by 1 when RL0 transitions from 0 to 1 depending on
input
I 0.0.
AN C1 Zero detection using the C1 bit.
= Q 0.0 Q 0.0 = 1 if counter 1 value is zero.
CU Counter Up
Example:
A I 2.1 If there is a positive edge change at input I 2.1.
CU C3 Counter C3 is incremented by 1 when RL0 transitions from 0 to 1.
L Load Current Counter Value into ACCU 1
Example:
L C3 Load ACCU 1-L with the count value of counter C3 in binary format.
LC Load Current Counter Value into ACCU 1 as BCD
Example:
LC C3 Load ACCU 1-L with the count value of counter C3 in binary coded decimal
format.
R Reset Counter
Example:
A I 2.3 Check signal state at input I 2.3.
R C3 Reset counter C3 to a value of 0 if RLO transitions from 0 to 1.
S Set Counter Preset Value
Example:
A I 2.3 Check signal state at input I 2.3.
L C#3 Load count value 3 into ACCU 1-L.
S C1 Set counter C1 to count value if RLO transitions from 0 to 1
PAGE 47
Data Block Instructions
Format: OPN <data block>
Example:
OPN DB10 Open data block DB10 as a shared data block.
L DBW35 Load data word 35 of the opened data block into ACCU 1-L.
T MW22 Transfer the content of ACCU 1-L into MW22.
OPN DI20 Open data block DB20 as an instance data block.
L DIB12 Load data byte 12 of the opened instance data block into ACCU 1-L.
T DBB37 Transfer the content of ACCU 1-L to data byte 37 of the opened shared data
block.
• Logic Control Instructions
JC Jump if RLO = 1
Example:
A I 1.0
A I 1.2
JC JOVR Jump if RLO=1 to jump label JOVR.
L IW8 Program scan continues here if jump is not executed.
T MW22
JOVR: A I 2.1 Program scan resumes here after jump to jump label JOVR.
JCB Jump if RLO = 1 with BR
Example:
A I 1.0
A I 1.2
JCB JOVR Jump if RLO = 1 to jump label JOVR. Copy the contents of the RLO bit
into the BR bit.
L IW8 Program scan continues here if jump is not executed.
T MW22
JOVR: A I 2.1 Program scan resumes here after jump to jump label JOVR.
JCN Jump if RLO = 0
Example:
A I 1.0
A I 1.2
JCN JOVR Jump if RLO = 0 to jump label JOVR.
L IW8 Program scan continues here if jump is not executed.
T MW22
JOVR: A I 2.1 Program scan resumes here after jump to jump label JOVR.
JM Jump if Minus
Example:
L IW8
L MW12
-I //Subtract contents of MW12 from contents of IW8.
PAGE 48
JM NEG //Jump if result < 0 (that is, contents of ACCU 1 < 0).
AN M 4.0 //Program scan continues here if jump is not executed.
S M 4.0
JU NEXT
NEG: AN M 4.1 //Program scan resumes here after jump to jump label NEG.
S M 4.1
NEXT: NOP 0 //Program scan resumes here after jump to jump label NEXT.
JMZ Jump if Minus or Zero
Example:
L IW8
L MW12
-I Subtract contents of MW12 from contents of IW8.
JMZ RGE0 Jump if result <=0 (that is, contents of ACCU 1 <= 0).
AN M 4.0 Program scan continues here if jump is not executed.
S M 4.0
JU NEXT
RGE0: AN M 4.1 Program scan resumes here after jump to jump label RGE0.
S M 4.1
NEXT: NOP 0 Program scan resumes here after jump to jump label NEXT.
JN Jump if Not Zero
Example:
L IW8
L MW12
XOW
JN NOZE Jump if the contents of ACCU 1-L are not equal to zero.
AN M 4.0 Program scan continues here if jump is not executed.
S M 4.0
JU NEXT
NOZE: AN M 4.1 Program scan resumes here after jump to jump label NOZE.
S M 4.1
NEXT: NOP 0 Program scan resumes here after jump to jump label NEXT.
JP Jump if Plus
Example:
L IW8
L MW12
-I Subtract contents of MW12 from contents of IW8.
JP POS Jump if result >0 (that is, ACCU 1 > 0).
AN M 4.0 Program scan continues here if jump is not executed.
S M 4.0
JU NEXT
POS: AN M 4.1 Program scan resumes here after jump to jump label POS.
S M 4.1
NEXT: NOP 0 Program scan resumes here after jump to jump label NEXT.
JPZ Jump if Plus or Zero
Example:
L IW8
PAGE 49
L MW12
-I Subtract contents of MW12 from contents of IW8.
JPZ REG0 Jump if result >=0 (that is, contents of ACCU 1 >= 0).
AN M 4.0 Program scan continues here if jump is not executed.
S M 4.0
JU NEXT
REG0: AN M 4.1 Program scan resumes here after jump to jump label REG0.
S M 4.1
NEXT: NOP 0 Program scan resumes here after jump to jump label NEXT.
JU Jump Unconditional
Example:
A I 1.0
A I 1.2
JC DELE Jump if RLO=1 to jump label DELE.
L MB10
INC 1
T MB10
JU FORW Jump unconditionally to jump label FORW.
DELE: L 0
T MB10
FORW: A I 2.1 Program scan resumes here after jump to jump label FORW.
JUO Jump if Unordered
Example:
L MD10
L ID2
/D Divide contents of MD10 by contents of ID2.
JUO ERRO Jump if division by zero (that is, ID2 = 0).
T MD14 Program scan continues here if jump is not executed.
A M 4.0
R M 4.0
JU NEXT
ERRO: AN M 4.0 Program scan resumes here after jump to jump label ERRO.
S M 4.0
NEXT: NOP 0 Program scan resumes here after jump to jump label NEXT.
JZ Jump if Zero
Example:
L MW10
SRW 1
JZ ZERO Jump to jump label ZERO if bit that has been shifted out = 0.
L MW2 Program scan continues here if jump is not executed.
INC 1
T MW2
JU NEXT
ZERO: L MW4 Program scan resumes here after jump to jump label ZERO.
INC 1
T MW4
NEXT: NOP 0 Program scan resumes here after jump to jump label NEXT.
PAGE 50
LOOP Loop
Example for calculating the factor of 5:
L L#1 Load the integer constant (32 bit) into ACCU 1.
T MD20 Transfer the contents from ACCU 1 into MD20 (initialization).
L 5 Load number of loop cycles into ACCU 1-L.
NEXT: T MW10 Jump label = loop start / transfer ACCU 1-L to loop counter.
L MD20
* D Multiply current contents of MD20 by the current contents of MB10.
T MD20 Transfer the multiplication result to MD20.
L MW10 Load contents of loop counter into ACCU 1.
LOOP NEXT Decr. the contents of ACCU 1 and jump to the NEXT jump label if ACCU 1-L > 0.
L MW24 Program scan resumes here after loop is finished.
L 200
>I
• Load and Transfer Instructions
L Load
L <address> loads the addressed byte, word, or double word into ACCU 1 after the old contents of
ACCU 1 have been saved into ACCU 2, and ACCU 1 is reset to "0".
Example:
L IB10 Load input byte IB10 into ACCU 1-L-L.
L MB120 Load memory byte MB120 into ACCU 1-L-L.
L DBB12 Load data byte DBB12 into ACCU 1-L-L.
L DIW15 Load instance data word DIW15 into ACCU 1-L.
L LD252 Load local data double word LD252 ACCU 1.
T Transfer
T <address> transfers (copies) the contents of ACCU 1 to the destination address if the Master
Control Relay is switched on (MCR = 1). If MCR = 0, then the destination address is written with 0.
The number of bytes copied from ACCU 1 depends on the size expressed in the destination address.
ACCU 1 also saves the data after the transfer procedure. A transfer to the direct I/O area (memory
type PQ) also transfers the contents of ACCU 1 or "0" (if MCR=0) to the corresponding address of the
process image output table (memory type Q). The instruction is executed without regard to, and
without affecting, the status bits.
Example:
T QB10 Transfers contents of ACCU 1-L-L to output byte QB10.
T MW14 Transfers contents of ACCU 1-L to memory word MW14.
T DBD2 Transfers contents of ACCU 1 to data double word DBD2.
PAGE 51
• Floating-Point Math Instructions; Basic
*R Multiply ACCU 1 and ACCU 2 as Floating Point Numbers (32-Bit IEEE-FP)
Example:
OPN DB10
L ID10 Load the value of ID10 into ACCU 1.
L MD14 Load the value of ACCU 1 into ACCU 2.Load the value of MD14 into
ACCU 1.
*R Multiply ACCU 2 and ACCU 1; store the result in ACCU 1.
T DBD25 The content of ACCU 1 (result) is transferred to DBD25 in DB10.
+R Add ACCU 1 and ACCU 2 as a Floating Point Number (32-Bit IEEE-FP)
Example:
OPN DB10
L ID10 Load the value of ID10 into ACCU 1.
L MD14 Load the value of ACCU 1 into ACCU 2.Load the value of MD14 into
ACCU 1.
+R Add ACCU 2 and ACCU 1; store the result in ACCU 1.
T DBD25 The content of ACCU 1 (result) is transferred to DBD25 in DB10.
-R Subtract ACCU 1 from ACCU 2 as a Floating Point Number (32-Bit IEEE-FP)
Example:
OPN DB10
L ID10 Load the value of ID10 into ACCU 1.
L MD14 Load the value of ACCU 1 into ACCU 2.Load the value of MD14 into
ACCU 1.
-R Subtract ACCU 1 from ACCU 2; store the result in ACCU 1.
T DBD25 The content of ACCU 1 (result) is transferred to DBD25 in DB10.
/R Divide ACCU 2 by ACCU 1 as a Floating Point Number (32-Bit IEEE-FP)
Example:
OPN DB10
L ID10 Load the value of ID10 into ACCU 1.
L MD14 Load the contents of ACCU 1 into ACCU 2.Load the value of MD14 into
ACCU 1.
/R Divide ACCU 2 by ACCU 1; store the result in ACCU 1.
T DBD20 The content of ACCU 1 (result) is transferred to DBD20 in DB10.
ABS Absolute Value of a Floating Point Number (32-Bit IEEE-FP)
Example:
L ID8 Load value into ACCU 1 (example: ID8 = -1.5E+02).
ABS Form the absolute value; store the result in ACCU 1.
T MD10 Transfer result to MD10 (example: result = 1.5E+02).
PAGE 52
Floating-Point Math Instructions: Extended
PAGE 53
Integer Math Instructions
+ Add Integer Constant (16, 32 Bit)
+ <integer constant> adds the integer constant to the contents of ACCU 1 and stores the result in
ACCU 1. The instruction is executed without regard to, and without affecting, the status word bits.
The contents of accumulator 2 remain unchanged for CPUs with two ACCUs.
The contents of accumulator 3 are copied into accumulator 2, and the contents of accumulator 4 are
copied into accumulator 3 for CPUs with four ACCUs. The contents of accumulator 4 remain
unchanged.
+ <16-bit integer constant>: Adds a 16-bit integer constant (in the range of -32768 to +32767) to the
contents of ACCU 1-L and stores the result in ACCU 1-L.
The contents of accumulator 2 remain unchanged for CPUs with two ACCUs.
The contents of accumulator 3 are copied into accumulator 2, and the contents of accumulator 4 are
copied into accumulator 3 for CPUs with four ACCUs. The contents of accumulator 4 remain
unchanged.
+ <32-bit integer constant>: Adds a 32-bit integer constant (in the range of -2,147,483,648 to
2,147,483,647) to the contents of ACCU 1 and stores the result in ACCU 1.
The contents of accumulator 2 remain unchanged for CPUs with two ACCUs.
The contents of accumulator 3 are copied into accumulator 2, and the contents of accumulator 4 are
copied into accumulator 3 for CPUs with four ACCUs. The contents of accumulator 4 remain
unchanged.
Example 1:
L IW10 Load the value of IW10 into ACCU 1-L.
L MW14 Load the contents of ACCU 1-L to ACCU 2-L. Load the value of MW14 into
ACCU 1-L.
+I Add ACCU 2-L and ACCU 1-L; store the result in ACCU 1-L.
+ 25 Add ACCU 1-L and 25; store the result in ACCU 1-L.
T DB1.DBW25 Transfer the contents of ACCU 1-L (result) to DBW25 of DB1.
Example 2:
L IW12
L IW14
+ 100 Add ACCU 1-L and 100; store the result in ACCU 1-L.
>I If ACCU 2 > ACCU 1, or IW12 > (IW14 + 100)
JC NEXT then conditional jump to jump label NEXT.
Example 3:
L MD20
L MD24
+D Add ACCU 1and ACCU 2; store the result in ACCU 1.
+ L#-200 Add ACCU 1 and -200; store the result in ACCU 1.
T MD28
+D Add ACCU 1 and ACCU 2 as Double Integer (32-Bit)
Example:
L ID10 Load the value of ID10 into ACCU 1.
L MD14 Load the contents of ACCU 1 to ACCU 2.Load the value of MD14 into
ACCU 1.
+D Add ACCU 2 and ACCU 1; store the result in ACCU 1.
T DB1.DBD25 The contents of ACCU 1 (result) are transferred to DBD25 of DB1.
PAGE 54
-D Subtract ACCU 1 from ACCU 2 as Double Integer (32-Bit)
Example:
L ID10 Load the value of ID10 into ACCU 1.
L MD14 Load the contents of ACCU 1 into ACCU 2.Load the value of MD14 into
ACCU 1.
-D Subtract ACCU 1 from ACCU 2; store the result in ACCU 1.
T DB1.DBD25 The contents of ACCU 1 (result) are transferred to DBD25 of DB1.
*D Multiply ACCU 1 and ACCU 2 as Double Integer (32-Bit)
Example:
L ID10 Load the value of ID10 into ACCU 1.
L MD14 Load contents of ACCU 1 into ACCU 2.Load contents of MD14 into ACCU 1.
*D Multiply ACCU 2 and ACCU 1; store the result in ACCU 1.
T DB1.DBD25 The contents of ACCU 1 (result) are transferred to DBD25 in DB1.
/D Divide ACCU 2 by ACCU 1 as Double Integer (32-Bit)
Example:
L ID10 Load the value of ID10 into ACCU 1.
L MD14 Load the contents of ACCU 1 into ACCU 2.Load the value of MD14 into
ACCU 1.
/D Divide ACCU 2 by ACCU 1; store the result (quotient) in ACCU 1.
T MD20 The contents of ACCU 1 (result) are transferred to MD20.
Example above: 13 divided by 4
Contents of ACCU 2 before instruction (ID10): "13"
Contents of ACCU 1 before instruction (MD14): "4"
Instruction /D (ACCU 2 / ACCU 1) : "13/4"
Contents of ACCU 1 after instruction (quotient): "3"
+I Add ACCU 1 and ACCU 2 as Integer (16-Bit)
Example:
L IW10 Load the value of IW10 into ACCU 1-L.
L MW14 Load the contents of ACCU 1-L into ACCU 2-L.Load the value of MW14 into
ACCU 1-L.
+I Add ACCU 2-L and ACCU 1-L; store the result in ACCU 1-L.
T DB1.DBW25 The contents of ACCU 1-L (result) are transferred to DBW25 of DB1.
-I Subtract ACCU 1 from ACCU 2 as Integer (16-Bit)
Example:
L IW10 Load the value of IW10 into ACCU 1-L.
L MW14 Load the contents of ACCU 1-L into ACCU 2-L.Load the value of MW14 into
ACCU 1-L.
-I Subtract ACCU 1-L from ACCU 2-L; store the result in ACCU 1-L.
T DB1.DBW25 The contents of ACCU 1-L (result) are transferred to DBW25 of DB1.
*I Multiply ACCU 1 and ACCU 2 as Integer (16-Bit)
Example:
PAGE 55
L IW10 Load the value of IW10 into ACCU 1-L.
L MW14 Load contents of ACCU 1-L into ACCU 2-L.Load contents of MW14 into
ACCU 1-
L.
*I Multiply ACCU 2-L and ACCU 1-L, store result in ACCU 1.
T DB1.DBD25 The contents of ACCU 1 (result) are transferred to DBW25 in DB1.
/I Divide ACCU 2 by ACCU 1 as Integer (16-Bit)
Example:
L IW10 Load the value of IW10 into ACCU 1-L.
L MW14 Load the contents of ACCU 1-L into ACCU 2-L.Load the value of MW14 into
ACCU 1-L.
/I Divide ACCU 2-L by ACCU 1-L; store the result in ACCU 1:ACCU 1-L:
quotient,
ACCU 1-H: remainder
T MD20 The contents of ACCU 1 (result) are transferred to MD20.
Example above: 13 divided by 4
Contents of ACCU 2-L before instruction (IW10):"13"
Contents of ACCU 1-L before instruction (MW14): "4"
Instruction /I (ACCU 2-L / ACCU 1-L): "13/4"
Contents of ACCU 1-L after instruction (quotient): "3"
Contents of ACCU 1-H after instruction (remainder): "1"
MOD Division Remainder Double Integer (32-Bit)
Example:
L ID10 Load the value of ID10 into ACCU 1.
L MD14 Load the contents of ACCU 1 into ACCU 2.Load the value of MD14 into
ACCU 1.
MOD Divide ACCU 2 by ACCU 1, store the result (remainder) in ACCU 1.
T MD20 The contents of ACCU 1 (result) are transferred to MD20.
Example above : 13 divided by 4
Contents of ACCU 2 before instruction (ID10): "13"
Contents of ACCU 1 before instruction (MD14): "4"
Instruction MOD (ACCU 2 / ACCU 1): "13/4"
Contents of ACCU 1 after instruction (remainder): "3"
PAGE 56
Program Control Instructions
BE Block End
BE (block end) terminates the program scan in the current block and causes a jump to the block that
called the current block. The program scan resumes with the first instruction that follows the block call
statement in the calling program.
BEC Block End Conditional
If RLO = 1, then BEC (block end conditional) interrupts the program scan in the current block and
causes a jump to the block that called the current block.
Example:
A I 1.0 Update RLO.
BEC End block if RLO = 1.
L IW4 Continue here if BEC is not executed, RLO = 0.
T MW10
BEU Block End Unconditional
BEU (block end unconditional) terminates the program scan in the current block and causes a jump to
the block that called the current block. The program scan resumes with the first instruction that follows
the block call.
Example:
A I 1.0
JC NEXT Jump to NEXT jump label if RLO = 1 (I 1.0 = 1).
L IW4 Continue here if no jump is executed.
T IW10
A I 6.0
A I 6.1
S M 12.0
BEU Block end unconditional.
NEXT: NOP 0 Continue here if jump is executed.
CALL Block Call
CALL <logic block identifier> is used to call functions (FCs) or function blocks (FBs), system functions
(SFCs) or system function blocks (SFBs) you created yourself or to call the standard pre-programmed
blocks shipped by Siemens. The CALL instruction calls the FC and SFC or the FB and SFB that you
input as an address, independent of the RLO or any other condition.
Example: CALL FB1, DB1 or CALL FILLVAT1, RECIPE1
Logic Block Block Type Absolute Address Call Syntax
FC Function CALL FCn
SFC System function CALL SFCn
FB Function block CALL FBn1,DBn2
SFB System function block CALL SFBn1,DBn2
Example 1: Assigning parameters to the FC6 call
CALL FC6
Formal parameter Actual parameter
NO OF TOOL := MW100
TIME OUT := MW110
FOUND:= Q 0.1
PAGE 57
ERROR := Q 100.0
Example 2: Calling an SFC without parameters
CALL SFC43 Call SFC43 to re-trigger watchdog timer (no parameters).
Example 3: Calling FB99 with instance data block DB1
CALL FB99,DB1
Formal parameter Actual parameter
MAX_RPM := #RPM1_MAX
MIN_RPM := #RPM2
MAX_POWER := #POWER
MAX_TEMP := #TEMP
Example 4: Calling FB99 with instance data block DB2
CALL FB99,DB2
Formal parameter Actual parameter
MAX_RPM := #RPM3_MAX
MIN_RPM := #RPM2
MAX_POWER := #POWER1
MAX_TEMP := #TEMP
CC Conditional Call
CC <logic block identifier> (conditional block call) calls a logic block if RLO=1. CC is used to call logic
blocks of the FC or SFC type without parameters.
Example:
A I 2.0 Check signal state at input I 2.0.
CC FC6 Call function FC6 if I 2.0 is "1".
A M 3.0 Executed upon return from called function (I 2.0 = 1) or directly after A I 2.0
statement if I 2.0 = 0.
UC Unconditional Call
UC <logic block identifier> (unconditional block call) calls a logic block of the FC or SFC type. UC is
like the CALL instruction, except that you cannot transfer parameters with the called block.
Example 1:
UC FC6 Call function FC6 (without parameters).
Example 2:
UC SFC43 Call system function SFC43 (without parameters).
PAGE 58
Shift Instructions
SLD Shift Left Double Word (32-Bit)
SLD <number>: The number of shifts is specified by the address <number>. The permissible value
range is from 0 to 32. The status word bits CC 0 and OV are reset to zero if <number> is greater than
zero. If <number> is equal to zero, then the shift instruction is regarded as a NOP operation.
Examples:
ACCU 1-H ACCU 1-L
Bit: 31 16 15 0
ACCU 1 before execution of SLD 5: 0101 1111 0110 0100 0101 1101 0011 1011
ACCU 1 after execution of SLD 5: 1110 1100 1000 1011 1010 0111 0110 0000
Example 1:
L MD4 Load value into ACCU 1.
SLD 5 Shift bits in ACCU 1 five places to the left.
T MD8 Transfer result to MD8.
SLW Shift Left Word (16-Bit)
SLW <number>: The number of shifts is specified by the address <number>. The permissible value
range is from 0 to 15. The status word bits CC 0 and OV are reset to zero if <number> is greater than
zero. If <number> is equal to zero, then the shift instruction is regarded as a NOP operation.
Examples:
ACCU 1-H ACCU 1-L
Bit: 31 16 15 0
ACCU 1 before execution of SLW 5: 0101 1111 0110 0100 0101 1101 0011 1011
ACCU 1 after execution of SLW 5: 0101 1111 0110 0100 1010 0111 0110 0000
Example 1:
L MW4 Load value into ACCU 1.
SLW 5 Shift the bits in ACCU 1 five places to the left.
T MW8 Transfer result to MW8.
SRD Shift Right Double Word (32-Bit)
SRD <number>: The number of shifts is specified by the address <number>. The permissible value
range is from 0 to 32. The status word bits CC 0 and OV are reset to 0 if <number> is greater thnan
zero.
Examples:
ACCU 1-H ACCU 1-L
Bit: 31 16 15 0
ACCU 1 before execution of SRD 7:0101 1111 0110 0100 0101 1101 0011 1011
ACCU 1 after execution of SRD 7: 0000 0000 1011 1110 1100 1000 1011 1010
Example 1:
L MD4 Load value into ACCU 1.
SRD 7 Shift bits in ACCU 1 seven places to the right.
T MD8 Transfer result to MD8.
SRW Shift Right Word (16-Bit)
SRW <number>: The number of shifts is specified by the address <number>. The permissible value
range is from 0 to 15. The status word bits CC 0 and OV are reset to 0 if <number> is greater than
zero.
PAGE 59
Examples:
ACCU 1-H ACCU 1-L
Bit: 31 16 15 0
ACCU 1 before execution of SRW 6: 0101 1111 0110 0100 0101 1101
0011 1011
ACCU 1 after execution of SRW 6: 0101 1111 0110 0100 0000 0001 0111
0100
Example 1:
L MW4 Load value into ACCU 1.
SRW 6 Shift bits in ACCU 1-L six places to the right.
T MW8 Transfer result to MW8.
PAGE 60
PAGE 61
Timer Instructions
SD On-Delay Timer
SD <timer> starts the addressed timer when the RLO transitions from "0" to "1". The programmed
time interval elapses as long as RLO = 1. The time is stopped if RLO transitions to "0" before the
programmed time interval has expired. This timer start instruction expects the time value and the time
base to be stored as a BCD number in ACCU 1-L.
Example:
A I 2.1
L S5T#10s Preset 10 seconds into ACCU 1.
SD T1 Start timer T1 as an on-delay timer.
PAGE 62
PAGE 63
SE Extended Pulse Timer
SE <timer> starts the addressed timer when the RLO transitions from "0" to "1". The programmed
time interval elapses, even if the RLO transitions to "0" in the meantime. The programmed time
interval is started again if RLO transitions from "0" to "1" before the programmed time has expired.
This timer start command expects the time value and the time base to be stored as a BCD number in
ACCU 1-L.
Example:
A I 2.1
L S5T#10s Preset 10 seconds into ACCU 1.
SE T1 Start timer T1 as an extended pulse timer.
A I 2.2
R T1 Reset timer T1.
A T1 Check signal state of timer T1.
= Q 4.0
PAGE 64
PAGE 65
SF Off-Delay Timer
SF <timer> starts the addressed timer when the RLO transitions from "1" to "0". The programmed
time elapses as long as RLO = 0. The time is stopped if RLO transitions to "1" before the programmed
time interval has expired. This timer start command expects the time value and the time base to be
stored as a BCD number in ACCU 1-L.
Example:
A I 2.1
L S5T#10s Preset 10 seconds into ACCU 1.
SF T1 Start timer T1 as an off-delay timer.
A I 2.2
R T1 Reset timer T1.
A T1 Check signal state of timer T1.
= Q 4.0
PAGE 66
PAGE 67
SP Pulse Timer
SP <timer> starts the addressed timer when the RLO transitions from "0" to "1". The programmed
time elapses as long as RLO = 1. The timer is stopped if RLO transitions to "0" before the
programmed time interval has expired. This timer start command expects the time value and the time
base to be stored as a BCD number in ACCU 1-L.
Example:
A I 2.1
L S5T#10s Preset 10 seconds into ACCU 1.
SP T1 Start timer T1 as a pulse timer.
A I 2.2
R T1 Reset timer T1.
A T1 Check signal state of timer T1.
= Q 4.0
PAGE 68
PAGE 69
SS Retentive On-Delay Timer
SS <timer> (start timer as a retentive ON timer) starts the addressed timer when the RLO transitions
from "0" to "1". The full programmed time interval elapses, even if the RLO transitions to "0" in the
meantime. The programmed time interval is re-triggered (started again) if RLO transitions from "0" to
"1" before the programmed time has expired. This timer start command expects the time value and
the time base to be stored as a BCD number in ACCU 1-L.
Example:
A I 2.1
L S5T#10s Preset 10 seconds into ACCU 1.
SS T1 Start timer T1 as a retentive on-delay timer.
A I 2.2
R T1 Reset timer T1.
A T1 Check signal state of timer T1.
= Q 4.0
PAGE 70
PAGE 71
PAGE 72
R Reset Timer
R <timer> stops the current timing function and clears the timer value and the time base of the
addressed timer word if the RLO transitions from 0 to 1.
Example:
A I 2.1
R T1 Check the signal state of input I 2.1 If RLO transitioned from 0 = 1, then reset timer
T1.
PAGE 73
Word Logic Instructions
AD AND Double Word (32-Bit)
AD (AND double word) combines the contents of ACCU 1 with ACCU 2 or a 32-bit constant bit by bit
according to the Boolean logic operation AND. A bit in the result double word is "1" only when the
corresponding bits of both double words combined in the logic operation are "1".
Examples:
Bit: 31 Bit:0
ACCU 1 before execution of AD: 0101 0000 1111 1100 1000 1001 0011 1011
ACCU 2 or 32-bit constant: 1111 0011 1000 0101 0111 0110 1011 0101
Result (ACCU 1) after execution of AD:0101 0000 1000 0100 0000 0000 0011 0001
L ID20 Load contents of ID20 into ACCU 1.
L ID24 Load contents of ACCU 1 into ACCU 2.Load contents of ID24 into ACCU 1.
AD Combine bits from ACCU 1 with ACCU 2 by AND, store result in ACCU 1.
T MD8 Transfer result to MD8.
AW AND Word (16-Bit)
AW (AND word) combines the contents of ACCU 1-L with ACCU 2-L or a 16 bit-constant bit by bit
according to the Boolean logic operation AND. A bit in the result word is "1" only when the
corresponding bits of both words combined in the logic operation are "1".
Examples:
Bit: 15 Bit:0
ACCU 1-L before execution of AW: 0101 1001 0011 1011
ACCU 2-L or 16-bit constant: 1111 0110 1011 0101
Result (ACCU 1-L) after execution of AW: 0101 0000 0011 0001
L IW20 Load contents of IW20 into ACCU 1-L.
L IW22 Load contents of ACCU 1 into ACCU 2.Load contents of IW22 into ACCU 1-L.
AW Combine bits from ACCU 1-L with ACCU 2-L bits by AND; store result in ACCU 1-L.
T MW 8 Transfer result to MW8.
OD OR Double Word (32-Bit)
OD (OR double word) combines the contents of ACCU 1 with ACCU 2 or a 32-bit constant bit by bit
according to the Boolean logic operation OR. A bit in the result double word is "1" when at least one of
the corresponding bits of both double words combined in the logic operation is "1".
Examples:
Bit: 31 Bit:0
ACCU 1 before execution of OD: 0101 0000 1111 1100 1000 0101 0011 1011
ACCU 2 or 32-bit constant: 1111 0011 1000 0101 0111 0110 1011 0101
Result (ACCU 1) after execution of OD:1111 0011 1111 1101 1111 0111 1011 1111
L ID20 Load contents of ID20 into ACCU 1.
L ID24 Load contents of ACCU 1 into ACCU 2.Load contents of ID24 into ACCU 1.
OD Combine bits from ACCU 1 with ACCU 2 bits by OR; store result in ACCU 1.
T MD8 Transfer result to MD8.
OW OR Word (16-Bit)
PAGE 74
OW (OR word) combines the contents of ACCU 1-L with ACCU 2-L or a 16 bit-constant bit by bit
according to the Boolean logic operation OR. A bit in the result word is "1" when at least one of the
corresponding bits of both words combined in the logic operation is "1".
Examples:
Bit: 15 Bit:0
ACCU 1-L before execution of OW: 0101 0101 0011 1011
ACCU 2-L or 16 bit constant: 1111 0110 1011 0101
Result (ACCU 1-L) after execution of OW: 1111 0111 1011 1111
L IW20 Load contents of IW20 into ACCU 1-L.
L IW22 Load contents of ACCU 1 into ACCU 2.Load contents of IW22 into ACCU 1-L.
OW Combine bits from ACCU 1-L with ACCU 2-L by OR, store result in ACCU 1-L.
T MW8 Transfer result to MW8.
XOD Exclusive OR Double Word (32-Bit)
XOD (XOR double word) combines the contents of ACCU 1 with ACCU 2 or a 32-bit constant bit by
bit according to the Boolean logic operation XOR (Exclusive Or). A bit in the result double word is "1"
when only one of the corresponding bits of both double words combined in the logic operation is "1".
Examples:
Bit: 31 Bit:0
ACCU 1 before execution of XOD: 0101 0000 1111 1100 1000 0101 0011 1011
ACCU 2 or 32-bit constant: 1111 0011 1000 0101 0111 0110 1011 0101
Result (ACCU 1) after execution of OD:1010 0011 0111 1001 1111 0011 1000 1110
L ID20 Load contents of ID20 into ACCU 1.
L ID24 Load contents of ACCU 1 into ACCU 2.Load contents of ID24 into ACCU 1.
XOD Combine bits from ACCU 1 with ACCU 2 by XOR; store result in ACCU 1.
T MD8 Transfer result to MD8.
XOW Exclusive OR Word (16-Bit)
XOW (XOR word) combines the contents of ACCU 1-L with ACCU 2-L or a 16 bit-constant bit by bit
according to the Boolean logic operation XOR. A bit in the result word is "1" only when one of the
corresponding bits of both words combined in the logic operation is "1".
Examples:
Bit: 15 Bit:0
ACCU 1 before execution of XOW: 0101 0101 0011 1011
ACCU 2-L or 16-bit constant: 1111 0110 1011 0101
Result (ACCU 1) after execution of XOW: 1010 0011 1000 1110
L IW20 Load contents of IW20 into ACCU 1-L.
L IW22 Load contents of ACCU 1 into ACCU 2.Load contents of ID24 into ACCU 1-L.
XOW Combine bits of ACCU 1-L with ACCU 2-L bits by XOR, store result in ACCU 1-L.
T MW8 Transfer result to MW8.
PAGE 75
Accumulator Instructions
DEC Decrement ACCU 1-L-L
Example:
L MB250 Load the value of MB250
DEC 1 Instruction "Decrement ACCU 1-L-L by 1"; store result in ACCU 1-L-L.
T MB250 Transfer the contents of ACCU 1-L-L (result) back to MB250.
INC Increment ACCU 1-L-L
Example:
L MB22 Load the value of MB22
INC 1 Instruction "Increment ACCU 1 (MB22) by 1"; store result in ACCU 1-L-L
T MB22 Transfer the contents of ACCU 1-L-L (result) back to MB22
TAK Toggle ACCU 1 with ACCU 2
Example:
Subtract smaller value from greater value:
Example:
L MW10 Load contents of MW10 into ACCU 1-L.
L MW12 Load contents of ACCU 1-L into ACCU 2-L.Load contents of MW12
into ACCU 1-
>I Check if ACCU 2-L (MW10) greater than ACCU 1-L (MW12).
JC NEXT Jump to NEXT jump label if ACCU 2 (MW10) is greater than ACCU 1
(MW12).
TAK Swap contents ACCU 1 and ACCU 2
NEXT: -I Subtract contents of ACCU 2-L from contents of ACCU 1-L.
T MW14 Transfer result (= greater value minus smaller value) to MW14.
PAGE 76
PROGRAMMING EXAMPLES
PAGE 77
PAGE 78
PAGE 79
PAGE 80
PAGE 81
PAGE 82
PAGE 83
PAGE 84
AUTOMATION & CONTROL SYTEMS PAGE 85
PUNE OFF: C-17,PAWANA IND. EST., T-204, MIDC - BHOSARI, PUNE-411026
MUMBAI OFF: 43, DATTANI CHAMBERS, NEAR NEW ERA THEATRE, S.V. ROAD, MALAD(W)
MUMBAI-64 TEL.: 022-8883737
AUTOMATION & CONTROL SYTEMS PAGE 85
PUNE OFF: C-17,PAWANA IND. EST., T-204, MIDC - BHOSARI, PUNE-411026
MUMBAI OFF: 43, DATTANI CHAMBERS, NEAR NEW ERA THEATRE, S.V. ROAD, MALAD(W)
MUMBAI-64 TEL.: 022-8883737
PAGE 86
PAGE 87
PAGE 88
PAGE 89
PAGE 90
PAGE 91
PAGE 92
PAGE 93
PAGE 94
PAGE 95
PAGE 96
PAGE 97
----------------------------------------------------------------------------------------------------------------
PAGE 98

Contenu connexe

Tendances

PLC Programming Languages
PLC Programming LanguagesPLC Programming Languages
PLC Programming LanguagesLIJU. G. CHACKO
 
Automation PLC & SCADA
Automation PLC & SCADA Automation PLC & SCADA
Automation PLC & SCADA NITISH SINGH
 
PLC and SCADA in Industrial Automation
PLC and SCADA in Industrial AutomationPLC and SCADA in Industrial Automation
PLC and SCADA in Industrial AutomationNikhil nnk
 
automation plc - scada
automation plc - scadaautomation plc - scada
automation plc - scadaSaif Akhtar
 
Summer training plc & scada
Summer training  plc & scada Summer training  plc & scada
Summer training plc & scada Arshit Rai
 
automation slides,plc,scada,HMI
automation slides,plc,scada,HMIautomation slides,plc,scada,HMI
automation slides,plc,scada,HMIBOSCH
 
programmable logic controller presentation
programmable logic controller presentationprogrammable logic controller presentation
programmable logic controller presentationAshutosh Verma
 
ppt on PLC automation
ppt on PLC automationppt on PLC automation
ppt on PLC automationMd Talib
 
Plc example presentation
Plc example presentationPlc example presentation
Plc example presentationRoshit Kadiru
 
Programmable logic controller - Siemens S7-1200
Programmable logic controller - Siemens S7-1200Programmable logic controller - Siemens S7-1200
Programmable logic controller - Siemens S7-1200Ahmed Elsayed
 
Industrial Training on PLC SCADA HMI for fresher engineers
Industrial Training on PLC SCADA HMI for fresher engineersIndustrial Training on PLC SCADA HMI for fresher engineers
Industrial Training on PLC SCADA HMI for fresher engineersSneha Yadav
 
INDUSTRIAL AUTOMATION USING PLC
INDUSTRIAL AUTOMATION USING PLCINDUSTRIAL AUTOMATION USING PLC
INDUSTRIAL AUTOMATION USING PLCMehvish Mushtaq
 
Plc Siemens Training Notes
Plc Siemens Training NotesPlc Siemens Training Notes
Plc Siemens Training Notesplc_course
 

Tendances (20)

DCS an overview
DCS an overviewDCS an overview
DCS an overview
 
PLC Programming Languages
PLC Programming LanguagesPLC Programming Languages
PLC Programming Languages
 
Automation PLC & SCADA
Automation PLC & SCADA Automation PLC & SCADA
Automation PLC & SCADA
 
PLC and SCADA in Industrial Automation
PLC and SCADA in Industrial AutomationPLC and SCADA in Industrial Automation
PLC and SCADA in Industrial Automation
 
automation plc - scada
automation plc - scadaautomation plc - scada
automation plc - scada
 
Summer training plc & scada
Summer training  plc & scada Summer training  plc & scada
Summer training plc & scada
 
PLC and SCADA
PLC and SCADAPLC and SCADA
PLC and SCADA
 
Controllogix 5000 Training
Controllogix 5000 TrainingControllogix 5000 Training
Controllogix 5000 Training
 
Plc basics
Plc basicsPlc basics
Plc basics
 
automation slides,plc,scada,HMI
automation slides,plc,scada,HMIautomation slides,plc,scada,HMI
automation slides,plc,scada,HMI
 
PLC - Programmable Logic Controller
PLC - Programmable Logic ControllerPLC - Programmable Logic Controller
PLC - Programmable Logic Controller
 
programmable logic controller presentation
programmable logic controller presentationprogrammable logic controller presentation
programmable logic controller presentation
 
ppt on PLC automation
ppt on PLC automationppt on PLC automation
ppt on PLC automation
 
Plc example presentation
Plc example presentationPlc example presentation
Plc example presentation
 
Plc and scada
Plc and scadaPlc and scada
Plc and scada
 
Programmable logic controller - Siemens S7-1200
Programmable logic controller - Siemens S7-1200Programmable logic controller - Siemens S7-1200
Programmable logic controller - Siemens S7-1200
 
Industrial Training on PLC SCADA HMI for fresher engineers
Industrial Training on PLC SCADA HMI for fresher engineersIndustrial Training on PLC SCADA HMI for fresher engineers
Industrial Training on PLC SCADA HMI for fresher engineers
 
PLC and SCADA
PLC and SCADAPLC and SCADA
PLC and SCADA
 
INDUSTRIAL AUTOMATION USING PLC
INDUSTRIAL AUTOMATION USING PLCINDUSTRIAL AUTOMATION USING PLC
INDUSTRIAL AUTOMATION USING PLC
 
Plc Siemens Training Notes
Plc Siemens Training NotesPlc Siemens Training Notes
Plc Siemens Training Notes
 

En vedette

Top Ten Siemens S7 Tips and Tricks
Top Ten Siemens S7 Tips and TricksTop Ten Siemens S7 Tips and Tricks
Top Ten Siemens S7 Tips and TricksDMC, Inc.
 
Top Ten Programming Mistakes by People New to Siemens
Top Ten Programming Mistakes by People New to SiemensTop Ten Programming Mistakes by People New to Siemens
Top Ten Programming Mistakes by People New to SiemensDMC, Inc.
 
PLC and SCADA training.
PLC and SCADA training.PLC and SCADA training.
PLC and SCADA training.Ishank Ranjan
 
Rapport de projet de fin d'études - SIEMENS 2016
Rapport de projet de fin d'études - SIEMENS 2016Rapport de projet de fin d'études - SIEMENS 2016
Rapport de projet de fin d'études - SIEMENS 2016Soufiane KALLIDA
 
Basics of Automation, PLC and SCADA
Basics of Automation, PLC and SCADABasics of Automation, PLC and SCADA
Basics of Automation, PLC and SCADAIndira Kundu
 
CLP S7 300 E S7 400
CLP S7 300 E S7 400 CLP S7 300 E S7 400
CLP S7 300 E S7 400 confidencial
 
Support soutenance PFE 11 juillet 2016 - EMSI - SIEMENS - Université de Borde...
Support soutenance PFE 11 juillet 2016 - EMSI - SIEMENS - Université de Borde...Support soutenance PFE 11 juillet 2016 - EMSI - SIEMENS - Université de Borde...
Support soutenance PFE 11 juillet 2016 - EMSI - SIEMENS - Université de Borde...Soufiane KALLIDA
 
PLC data types and addressing
PLC data types and addressingPLC data types and addressing
PLC data types and addressingAmeen San
 
Basic of MODBUS Communication/Protocol
Basic of MODBUS Communication/ProtocolBasic of MODBUS Communication/Protocol
Basic of MODBUS Communication/ProtocolShivam Singh
 
S7 300 stl_programming_manual
S7 300 stl_programming_manualS7 300 stl_programming_manual
S7 300 stl_programming_manualPaulo Sérgio
 
Rapport - H.KASSMI & M.ELHADI
Rapport - H.KASSMI & M.ELHADIRapport - H.KASSMI & M.ELHADI
Rapport - H.KASSMI & M.ELHADIHamza Kassimi
 
Supervision industrielle www.automate pro.blogspot.com
Supervision industrielle www.automate pro.blogspot.comSupervision industrielle www.automate pro.blogspot.com
Supervision industrielle www.automate pro.blogspot.comAdnane Ahmidani
 

En vedette (19)

Top Ten Siemens S7 Tips and Tricks
Top Ten Siemens S7 Tips and TricksTop Ten Siemens S7 Tips and Tricks
Top Ten Siemens S7 Tips and Tricks
 
Simens plc training. simatic working-with-step-7
Simens  plc  training. simatic working-with-step-7Simens  plc  training. simatic working-with-step-7
Simens plc training. simatic working-with-step-7
 
Top Ten Programming Mistakes by People New to Siemens
Top Ten Programming Mistakes by People New to SiemensTop Ten Programming Mistakes by People New to Siemens
Top Ten Programming Mistakes by People New to Siemens
 
PLC and SCADA training.
PLC and SCADA training.PLC and SCADA training.
PLC and SCADA training.
 
ppt on PLC
ppt on PLCppt on PLC
ppt on PLC
 
Rapport de projet de fin d'études - SIEMENS 2016
Rapport de projet de fin d'études - SIEMENS 2016Rapport de projet de fin d'études - SIEMENS 2016
Rapport de projet de fin d'études - SIEMENS 2016
 
Basics of Automation, PLC and SCADA
Basics of Automation, PLC and SCADABasics of Automation, PLC and SCADA
Basics of Automation, PLC and SCADA
 
CLP S7 300 E S7 400
CLP S7 300 E S7 400 CLP S7 300 E S7 400
CLP S7 300 E S7 400
 
SIEMENS PLC S7-300&WINCC COURSE
SIEMENS PLC S7-300&WINCC COURSESIEMENS PLC S7-300&WINCC COURSE
SIEMENS PLC S7-300&WINCC COURSE
 
PLC Troubleshooting & Maintenance
PLC Troubleshooting & MaintenancePLC Troubleshooting & Maintenance
PLC Troubleshooting & Maintenance
 
Support soutenance PFE 11 juillet 2016 - EMSI - SIEMENS - Université de Borde...
Support soutenance PFE 11 juillet 2016 - EMSI - SIEMENS - Université de Borde...Support soutenance PFE 11 juillet 2016 - EMSI - SIEMENS - Université de Borde...
Support soutenance PFE 11 juillet 2016 - EMSI - SIEMENS - Université de Borde...
 
PLC data types and addressing
PLC data types and addressingPLC data types and addressing
PLC data types and addressing
 
Omron plc training
Omron plc trainingOmron plc training
Omron plc training
 
S7 bas-16
S7 bas-16S7 bas-16
S7 bas-16
 
Plc ppt
Plc pptPlc ppt
Plc ppt
 
Basic of MODBUS Communication/Protocol
Basic of MODBUS Communication/ProtocolBasic of MODBUS Communication/Protocol
Basic of MODBUS Communication/Protocol
 
S7 300 stl_programming_manual
S7 300 stl_programming_manualS7 300 stl_programming_manual
S7 300 stl_programming_manual
 
Rapport - H.KASSMI & M.ELHADI
Rapport - H.KASSMI & M.ELHADIRapport - H.KASSMI & M.ELHADI
Rapport - H.KASSMI & M.ELHADI
 
Supervision industrielle www.automate pro.blogspot.com
Supervision industrielle www.automate pro.blogspot.comSupervision industrielle www.automate pro.blogspot.com
Supervision industrielle www.automate pro.blogspot.com
 

Similaire à Siemens s7 300 programming

SIMATIC manager سيماتك منجر سيمنز
SIMATIC manager سيماتك منجر سيمنزSIMATIC manager سيماتك منجر سيمنز
SIMATIC manager سيماتك منجر سيمنزEssosElectronic
 
manuales y guías PLC siemens Simatic S7
manuales y guías  PLC siemens Simatic S7manuales y guías  PLC siemens Simatic S7
manuales y guías PLC siemens Simatic S7SANTIAGO PABLO ALBERTO
 
Programmable Logic Controllers
Programmable Logic ControllersProgrammable Logic Controllers
Programmable Logic ControllersAnchit Walia
 
Embedded system by owais
Embedded system by owaisEmbedded system by owais
Embedded system by owaisOwais Mushtaq
 
Electroneumática: Fluidísim con electroneumática
Electroneumática: Fluidísim con electroneumática Electroneumática: Fluidísim con electroneumática
Electroneumática: Fluidísim con electroneumática SANTIAGO PABLO ALBERTO
 
IMAGE CAPTURE, PROCESSING AND TRANSFER VIA ETHERNET UNDER CONTROL OF MATLAB G...
IMAGE CAPTURE, PROCESSING AND TRANSFER VIA ETHERNET UNDER CONTROL OF MATLAB G...IMAGE CAPTURE, PROCESSING AND TRANSFER VIA ETHERNET UNDER CONTROL OF MATLAB G...
IMAGE CAPTURE, PROCESSING AND TRANSFER VIA ETHERNET UNDER CONTROL OF MATLAB G...Christopher Diamantopoulos
 
Simulation and Modelling of 3-Floor Elevator System using PLC
Simulation and Modelling of 3-Floor Elevator System using PLCSimulation and Modelling of 3-Floor Elevator System using PLC
Simulation and Modelling of 3-Floor Elevator System using PLCIRJET Journal
 
Amp bluac5 specsheet
Amp bluac5 specsheetAmp bluac5 specsheet
Amp bluac5 specsheetElectromate
 
System Architecture Exploration Training Class
System Architecture Exploration Training ClassSystem Architecture Exploration Training Class
System Architecture Exploration Training ClassDeepak Shankar
 
PLC Introduction Details
PLC Introduction DetailsPLC Introduction Details
PLC Introduction Detailssuhaskhadake
 
EE6602 Embedded System
EE6602 Embedded SystemEE6602 Embedded System
EE6602 Embedded Systemrmkceteee
 
Substation Automation SCADA and Gateway Solutions by BRH
Substation Automation SCADA and Gateway Solutions by BRHSubstation Automation SCADA and Gateway Solutions by BRH
Substation Automation SCADA and Gateway Solutions by BRHbirinder2
 
Overview of IoT/M2M Capability
Overview of IoT/M2M CapabilityOverview of IoT/M2M Capability
Overview of IoT/M2M CapabilityALTEN Calsoft Labs
 
Aerospace maintenance facility increases utilization by 50%, saves money
Aerospace maintenance facility increases utilization by 50%, saves moneyAerospace maintenance facility increases utilization by 50%, saves money
Aerospace maintenance facility increases utilization by 50%, saves moneyIntelligentManufacturingInstitute
 
INDUSTRIAL TRAINING REPORT EMBEDDED SYSTEM.pptx
INDUSTRIAL TRAINING REPORT EMBEDDED SYSTEM.pptxINDUSTRIAL TRAINING REPORT EMBEDDED SYSTEM.pptx
INDUSTRIAL TRAINING REPORT EMBEDDED SYSTEM.pptxMeghdeepSingh
 

Similaire à Siemens s7 300 programming (20)

SIMATIC manager سيماتك منجر سيمنز
SIMATIC manager سيماتك منجر سيمنزSIMATIC manager سيماتك منجر سيمنز
SIMATIC manager سيماتك منجر سيمنز
 
manuales y guías PLC siemens Simatic S7
manuales y guías  PLC siemens Simatic S7manuales y guías  PLC siemens Simatic S7
manuales y guías PLC siemens Simatic S7
 
Introduction to Blackfin BF532 DSP
Introduction to Blackfin BF532 DSPIntroduction to Blackfin BF532 DSP
Introduction to Blackfin BF532 DSP
 
Plc 1
Plc 1Plc 1
Plc 1
 
Programmable Logic Controllers
Programmable Logic ControllersProgrammable Logic Controllers
Programmable Logic Controllers
 
Embedded system by owais
Embedded system by owaisEmbedded system by owais
Embedded system by owais
 
AUToSAR introduction
AUToSAR introductionAUToSAR introduction
AUToSAR introduction
 
Electroneumática: Fluidísim con electroneumática
Electroneumática: Fluidísim con electroneumática Electroneumática: Fluidísim con electroneumática
Electroneumática: Fluidísim con electroneumática
 
IMAGE CAPTURE, PROCESSING AND TRANSFER VIA ETHERNET UNDER CONTROL OF MATLAB G...
IMAGE CAPTURE, PROCESSING AND TRANSFER VIA ETHERNET UNDER CONTROL OF MATLAB G...IMAGE CAPTURE, PROCESSING AND TRANSFER VIA ETHERNET UNDER CONTROL OF MATLAB G...
IMAGE CAPTURE, PROCESSING AND TRANSFER VIA ETHERNET UNDER CONTROL OF MATLAB G...
 
Simulation and Modelling of 3-Floor Elevator System using PLC
Simulation and Modelling of 3-Floor Elevator System using PLCSimulation and Modelling of 3-Floor Elevator System using PLC
Simulation and Modelling of 3-Floor Elevator System using PLC
 
Amp bluac5 specsheet
Amp bluac5 specsheetAmp bluac5 specsheet
Amp bluac5 specsheet
 
System Architecture Exploration Training Class
System Architecture Exploration Training ClassSystem Architecture Exploration Training Class
System Architecture Exploration Training Class
 
plc-basics.pptx
plc-basics.pptxplc-basics.pptx
plc-basics.pptx
 
BHAVESH AGRAWAL.pptx
BHAVESH AGRAWAL.pptxBHAVESH AGRAWAL.pptx
BHAVESH AGRAWAL.pptx
 
PLC Introduction Details
PLC Introduction DetailsPLC Introduction Details
PLC Introduction Details
 
EE6602 Embedded System
EE6602 Embedded SystemEE6602 Embedded System
EE6602 Embedded System
 
Substation Automation SCADA and Gateway Solutions by BRH
Substation Automation SCADA and Gateway Solutions by BRHSubstation Automation SCADA and Gateway Solutions by BRH
Substation Automation SCADA and Gateway Solutions by BRH
 
Overview of IoT/M2M Capability
Overview of IoT/M2M CapabilityOverview of IoT/M2M Capability
Overview of IoT/M2M Capability
 
Aerospace maintenance facility increases utilization by 50%, saves money
Aerospace maintenance facility increases utilization by 50%, saves moneyAerospace maintenance facility increases utilization by 50%, saves money
Aerospace maintenance facility increases utilization by 50%, saves money
 
INDUSTRIAL TRAINING REPORT EMBEDDED SYSTEM.pptx
INDUSTRIAL TRAINING REPORT EMBEDDED SYSTEM.pptxINDUSTRIAL TRAINING REPORT EMBEDDED SYSTEM.pptx
INDUSTRIAL TRAINING REPORT EMBEDDED SYSTEM.pptx
 

Dernier

Glass Ceramics: Processing and Properties
Glass Ceramics: Processing and PropertiesGlass Ceramics: Processing and Properties
Glass Ceramics: Processing and PropertiesPrabhanshu Chaturvedi
 
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756dollysharma2066
 
Thermal Engineering Unit - I & II . ppt
Thermal Engineering  Unit - I & II . pptThermal Engineering  Unit - I & II . ppt
Thermal Engineering Unit - I & II . pptDineshKumar4165
 
Unit 1 - Soil Classification and Compaction.pdf
Unit 1 - Soil Classification and Compaction.pdfUnit 1 - Soil Classification and Compaction.pdf
Unit 1 - Soil Classification and Compaction.pdfRagavanV2
 
UNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its PerformanceUNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its Performancesivaprakash250
 
Call Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance BookingCall Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance Bookingroncy bisnoi
 
Vivazz, Mieres Social Housing Design Spain
Vivazz, Mieres Social Housing Design SpainVivazz, Mieres Social Housing Design Spain
Vivazz, Mieres Social Housing Design Spaintimesproduction05
 
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...SUHANI PANDEY
 
KubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghlyKubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghlysanyuktamishra911
 
result management system report for college project
result management system report for college projectresult management system report for college project
result management system report for college projectTonystark477637
 
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...ranjana rawat
 
Generative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPTGenerative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPTbhaskargani46
 
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Bookingdharasingh5698
 
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordCCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordAsst.prof M.Gokilavani
 
chapter 5.pptx: drainage and irrigation engineering
chapter 5.pptx: drainage and irrigation engineeringchapter 5.pptx: drainage and irrigation engineering
chapter 5.pptx: drainage and irrigation engineeringmulugeta48
 
Call for Papers - International Journal of Intelligent Systems and Applicatio...
Call for Papers - International Journal of Intelligent Systems and Applicatio...Call for Papers - International Journal of Intelligent Systems and Applicatio...
Call for Papers - International Journal of Intelligent Systems and Applicatio...Christo Ananth
 
Thermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.pptThermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.pptDineshKumar4165
 
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Call Girls in Nagpur High Profile
 
Booking open Available Pune Call Girls Pargaon 6297143586 Call Hot Indian Gi...
Booking open Available Pune Call Girls Pargaon  6297143586 Call Hot Indian Gi...Booking open Available Pune Call Girls Pargaon  6297143586 Call Hot Indian Gi...
Booking open Available Pune Call Girls Pargaon 6297143586 Call Hot Indian Gi...Call Girls in Nagpur High Profile
 

Dernier (20)

Glass Ceramics: Processing and Properties
Glass Ceramics: Processing and PropertiesGlass Ceramics: Processing and Properties
Glass Ceramics: Processing and Properties
 
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
 
Thermal Engineering Unit - I & II . ppt
Thermal Engineering  Unit - I & II . pptThermal Engineering  Unit - I & II . ppt
Thermal Engineering Unit - I & II . ppt
 
Unit 1 - Soil Classification and Compaction.pdf
Unit 1 - Soil Classification and Compaction.pdfUnit 1 - Soil Classification and Compaction.pdf
Unit 1 - Soil Classification and Compaction.pdf
 
UNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its PerformanceUNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its Performance
 
Call Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance BookingCall Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance Booking
 
Vivazz, Mieres Social Housing Design Spain
Vivazz, Mieres Social Housing Design SpainVivazz, Mieres Social Housing Design Spain
Vivazz, Mieres Social Housing Design Spain
 
Roadmap to Membership of RICS - Pathways and Routes
Roadmap to Membership of RICS - Pathways and RoutesRoadmap to Membership of RICS - Pathways and Routes
Roadmap to Membership of RICS - Pathways and Routes
 
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...
 
KubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghlyKubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghly
 
result management system report for college project
result management system report for college projectresult management system report for college project
result management system report for college project
 
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
 
Generative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPTGenerative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPT
 
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
 
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordCCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
 
chapter 5.pptx: drainage and irrigation engineering
chapter 5.pptx: drainage and irrigation engineeringchapter 5.pptx: drainage and irrigation engineering
chapter 5.pptx: drainage and irrigation engineering
 
Call for Papers - International Journal of Intelligent Systems and Applicatio...
Call for Papers - International Journal of Intelligent Systems and Applicatio...Call for Papers - International Journal of Intelligent Systems and Applicatio...
Call for Papers - International Journal of Intelligent Systems and Applicatio...
 
Thermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.pptThermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.ppt
 
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
 
Booking open Available Pune Call Girls Pargaon 6297143586 Call Hot Indian Gi...
Booking open Available Pune Call Girls Pargaon  6297143586 Call Hot Indian Gi...Booking open Available Pune Call Girls Pargaon  6297143586 Call Hot Indian Gi...
Booking open Available Pune Call Girls Pargaon 6297143586 Call Hot Indian Gi...
 

Siemens s7 300 programming

  • 2. CONTENTS: PAGE NO 1. STEP7 OVERVIEW 4 2. COMPARISON OF CPU's AND MODULES AVAILABLE 8 3. ADDRESSING OF MODULES 10 4. LOAD MEMORY AND WORK MEMORY 12 5. BLOCKS IN THE USER PROGRAM 14 6. DATA TYPES 15 7. STATEMENT LIST PROGRAMMING 17 8. BIT LOGIC INSTRUCTIONS 24 9. COMPARISON INSTRUCTIONS 28 10.CONVERSION INSTRUCTIONS 30 11.COUNTER INSTRUCTIONS 39 12.DATA BLOCK AND LOGIC CONTROL INSTRUCTIONS 46 13.LOAD AND TRANSFER INSTRUCTIONS 49 14.FLOATING POINT MATH INSTRUCTIONS 50 15.INTEGER MATH INSTRUCTIONS 52 16.PROGRAM CONTROL INSTRUCTIONS 55 17.SHIFT INSTRUCTIONS 57 18.TIMER INSTRUCTIONS 59 19.WORD LOGIC INSTRUCTIONS 72 20.ACCUMULATOR INSTRUCTIONS 74 21.PROGRAMMING EXAMPLES 76 22.GLOSSARY 87 SIMATIC S7 PAGE 2
  • 3. PLC RANGE S7-400 HIGH END RANGE/MEDIUM RANGE S7-300 MID AND LOW END PERFORMANCE RANGE S7-200 MICRO PLC'S 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 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 time 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 S7-300 8. Sinec L2 cable with LAN connector Interconnects CPUs and PCs 9. Programmer Cable Connects a CPU to a programming device 10. RS 485 Repeater Interfaces the S7-300 over large distances to other S7- 300s or programming devices PAGE 3
  • 4. Overview of STEP 7 What is STEP 7? • STEP 7 is the standard software package used for configuring and 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 As shown in the figure above, you have two alternative procedures: PAGE 4
  • 5. • 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. Brief Description of the Individual Steps • Installation and authorization The first time you use STEP 7, install it and transfer the 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. 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 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 create a program linked to a module or 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, 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 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, you can download your entire user program or individual blocks from it to the programmable controller (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 PAGE 5
  • 6. • 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 6
  • 7. COMPARISON OF CPU'S CPU's CPU312IFM CPU313 CPU314IFM CPU314 Mem Statement/Bytes 2K/6KB 4K/12KB 8K/24KB 16K/48KB Memory Cards - 512KB FEPROM - 512KB FEPROM Processing Time 1024 Statements 0.6 ms 0.6 ms 0.3 ms 0.3 ms DI & DO Max 256 256 1024 1024 AI & AO Max 64 64 256 256 Rack Configuration 1-Tier 1-Tier 4-Tier 4-Tier Expansion Modules Max 8 8 31 31 Bit Memories 1024 2048 2048 2048 Counters 32 32 64 64 Timers 64 64 72 128 MPI Interface 187.5 Kbit/s Max 32 Nodes Yes Yes Yes Yes Integrated functions+Interfaces 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 16K/48KB 16K/48KB 42K/128KB 256KB Memory Cards 512KB FEPROM 512KB FEPROM 4MB FEPROM 4MB FEPROM Processing Time 1024 Statements 0.3 ms 0.3 ms 0.3 ms 0.1 ms DI & DO Max 1024 2048 4096 16384 AI & AO Max 256 256 256 1024 Rack Configuration 4-Tier 4-Tier 4-Tier 4-Tier Expansion Modules Max 32 32 32 32 Bit Memories 2048 2048 2048 8192 Counters 64 64 64 512 Timers 128 128 128 512 MPI Interface 187.5 Kbit/s Max 32 Nodes Yes Yes Yes Upto 12Mbaud Integrated functions+Interfaces - PROFIBUS- DP Master/Slave (64 DP stations,12M baud) PROFIBUS- DP Master/Slave (64 DP stations,12M baud) PROFIBUS-DP Master/Slave (125 DP stations,12Mb aud) PAGE 7
  • 8. * 1 K statements correspond to approx. 3Kbytes of user memory. PAGE 8
  • 9. THE DIFFERENT TYPES OF MODULES AVAILABLE ARE 1. SIGNAL MODULES - FOR DIGITAL AND ANALOG SIGNALS DIGITAL INPUTS DIGITAL OUTPUTS • 16 X 24 VDC • 8 X 120 / 230 VAC • 16 X 120 V AC • 32 X 24 V DC • 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 DI/DO MODULES • 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 • 8DI/8DO X 24VDC 0.5A ANALOG INPUTS PARAMETERIZABLE ANALOG OUTPUTS PARAMETERIZABLE • 8 Analog Inputs/ 2 Analog Inputs • +/- 10V , +/- 50 mV, +/-1 V, +/-20 Ma, 4 to 20mA, Pt100, Thermocouple • 4 Analog Outputs/ 2 Analog Outputs • +/-10V, +/-50mV, +/-1 V, +/-20 mV, 4 to 20 mA 2. FUNCTION MODULES • High Speed Counter Modules - Upto 100 KHz range • Positioning Modules - For position control, Stepper Motor Control, Cam Controllers All function modules are enclosed and can be installed in any slot. 3. COMMUNICATION PROCESSORS - FOR DATA EXCHANGE WITH PRINTERS,COMPUTERS, SIMATIC SYSTEMS • CP340 - Point to Point Communication for the serial link with RS232, 3964R and any ASCII protocol 4. INTERFACE MODULES - FOR MULTI TIER CONFIGURATION • For Central Controller Expansion • For Expansion Unit Connection 5. POWER SUPPLY MODULES - FOR 24 VDC LOAD CIRCUITS WITH DIFFERENT RATINGS. MPI - MULTI POINT INTERFACE FOR COMMUNICATION • MPI INTEGRATED IN CPU • DATA EXCHANGE RATE : 187.5 Kbits / s PAGE 9
  • 10. MUMBAI-64 TEL.: 022-8883737 • SIMULTANEOUS COMMUNICATION WITH PG/PC/OP(OPERATOR PANEL) AND FURTHER PLCS REQUIRING NO ADDITIONAL HARDWARE • UPTO 32 NODES CAN BE CONNECTED ADDRESSING OF MODULES MUMBAI OFF: 43, DATTANI CHAMBERS, NEAR NEW ERA THEATRE, S.V. ROAD, MALAD(W) Slot Addressing for Rack 0 • CPU RACK 0 Slot Number 1 2 3 Digital Address Analog Address 4 0 256 PS 5 4 272 11 28 368 10 24 352 9 20 336 8 16 320 7 12 304 6 8 288 Module Starting Addresses of the Signal Modules on Rack 0 Slot Addressing for Rack 1 4 64 512 4 32 384 6 40 416 7 44 432 8 48 448 9 52 464 10 56 480 11 60 496 5 36 400 RACK 1 Slot Number 3 Digital Address Analog Address CPU IM AI / AO / DI / DO Modules Module Starting Addresses of the Signal Modules on Rack 1
  • 11. PAGE 11 CPU IM AI / AO / DI / DO Modules Slot Addressing for Rack 3 Module Starting Addresses of the Signal Modules on Rack 3 RACK 3 Slot Number 3 Digital Address Analog Address 5 100 656 11 124 752 10 120 736 9 116 720 8 112 704 7 108 688 6 104 672 4 64 512 4 96 640 Slot Addressing for Rack 2 Module Starting Addresses of the Signal Modules on Rack 2 RACK 2 Slot Number 3 Digital Address Analog Address 5 68 528 11 92 624 10 88 608 9 84 592 8 80 576 7 76 560 6 72 544 4 64 512 4 64 512
  • 12. PAGE 12 PUNE OFF: C-17,PAWANA IND. EST., T-204, MIDC - BHOSARI, PUNE-411026 Rack 0 4 CPU Slot Number 1 2 (IM) 3 PS 1110 Rack 1 111098744 64Connecting cable 368 Slot Number IM 5 6 512 Rack 2 111098744 64Connecting cable 368 Slot Number IM 5 6 512 Rack 3 Slot Number IM 5 1110987644 64 512 98765
  • 13. Load Memory and Work Memory in the CPU After completing the configuration, parameter assignment, and program creation and establishing the online connection, you can download complete user programs or individual blocks to a programmable controller. To test individual blocks, you must download at least one organization block (OB) and the function blocks (FB) and functions (FC) called in the OB and the data blocks (DB) used. To download the system data created when the hardware was configured, the networks configured, and the connection table created to the programmable controller, you download the object “System Data". You download user programs to a programmable controller using the SIMATIC Manager, for example, during the end phase of the program testing or to run the finished user program. Relationship - Load Memory and Work Memory The complete user program is downloaded to the load memory; the parts relevant to program execution are also loaded into the work memory. CPU Load Memory • The load memory is used to store the user program without the symbol table and the comments (these remain in the memory of the programming device). • Blocks that are not marked as required for startup will be stored only in the load memory. • The load memory can either be RAM, ROM, or EPROM memory, depending on the programmable controller. CPU Work Memory The work memory (integrated RAM) is used to store the parts of the user program required for program processing. Possible Downloading/Uploading Procedures You use the download function to download the user program or loadable objects (for example, blocks) to the programmable controller. If a block already exists in the RAM of the CPU, you will be prompted to confirm whether or not the block should be overwritten. • You can select the loadable objects in the project window and download them from the SIMATIC Manager (menu command: PLC > Download). • When programming blocks and when configuring hardware and networks you can directly download the object you were currently editing using the menu in the main window of the application you are working with (menu command: PLC > Download). • Another possibility is to open an online window with a view of the programmable controller (for example, using View > Online or PLC > Display Accessible Nodes) and copy the object you want to download to the online window. Alternatively you can upload the current contents of blocks from the RAM load memory of the CPU to your programming device via the load function. PAGE 13
  • 14. Blocks in the User Program The STEP 7 programming software allows you to structure your user program, in other words to break down the program into individual, self-contained program sections. This has the following advantages: • Extensive programs are easier to understand. • Individual program sections can be standardized. • Program organization is simplified. • It is easier to make modifications to the program. • Debugging is simplified since you can test separate sections. • Commissioning your system is made much easier. The example of an industrial blending process illustrated the advantages of breaking down an automation process into individual tasks. The program sections of a structured user program correspond to these individual tasks and are known as the blocks of a program. Block Types There are several different types of blocks you can use within an S7 user program: Block Brief Description Of Function Organization blocks (OB) OBs determine the structure of the user program. System function blocks (SFB) and system functions (SFC) SFBs and SFCs are integrated in the S7 CPU and allow you access to some important system functions. Function blocks (FB) FBs are blocks with a "memory" which you can program yourself. Functions (FC) FCs contain program routines for frequently used functions. Instance data blocks (instance DB) Instance DBs are associated with the block when an FB/SFB is called. They are created automatically during compilation. Data blocks (DB) DBs are data areas for storing user data. In addition to the data that are assigned to a function block, shared data can also be defined and used by any blocks. OBs, FBs, SFBs, FCs, and SFCs contain sections of the program and are therefore also known as logic blocks. The permitted number of blocks per block type and the permitted length of the blocks is CPU-specific. PAGE 14
  • 15. DATA TYPES Introduction to Data Types and Parameter Types All the data in a user program must be identified by a data type. The following data types are available: • Elementary data types provided by STEP 7 • Complex data types that you yourself can create by combining elementary data types • Parameter types with which you define parameters to be transferred to FBs or FCs General Information Statement List, Ladder Logic, and Function Block Diagram instructions work with data objects of specific sizes. Bit logic instructions work with bits, for example. Load and transfer instructions (STL) and move instructions (LAD and FBD) work with bytes, words, and double words. A bit is a binary digit "0" or "1." A byte is made up of eight bits, a word of 16 bits, and a double word of 32 bits. Math instructions also work with bytes, words, or double words. In these byte, word, or double word addresses you can code numbers of various formats such as integers and floating-point numbers. When you use symbolic addressing, you define symbols and specify a data type for these symbols (see table below). Different data types have different format options and number notations. This chapter describes only some of the ways of writing numbers and constants. The following table lists the formats of numbers and constants that will not be explained in detail. Format Size in Bits Number Notation Hexadecimal 8, 16, and 32 B#16#, W#16#, and DW#16# Binary 8, 16, and 32 2# date 16 D# time 32 T# Time of day 32 TOD# Character 8 'A' Elementary Data Types Each elementary data type has a defined length. The following table lists the elementary data types. Type and Description Size in Bits Format Options Range and Number Notation (lowest to highest value)_ Example BOOL(Bit) Boolean text TRUE/FALSE TRUE BYTE (Byte) 8 Hexadecimal number B16#0 to B16#FF L B#16#10 L byte#16#10 WORD (Word) 16 Binary number Hexadecimal number BCD Decimal number unsigned 2. 0 to 2#1111_1111_1111_1111 W#16#0 to W#16#FFFF C#0 to C#999 B#(0.0) to B#(255.255) L 2#0001_0000_0000_0000 L W#16#1000 L word16#1000 L C#998 L B#(10,20) L byte#(10,20) DWORD 32 Binary number 2#0 to 2#1000_0001_0001_1000_ PAGE 15
  • 16. (Double word) Hexadecimal number Decimal number unsigned 2#1111_1111_1111_1111 1111_1111_1111_1111 DW#16#0000_0000 to DW#16#FFFF_FFFF B#(0,0,0,0) to B#(255,255,255,255) 1011_1011_0111_1111 L DW#16#00A2_1234 L dword#16#00A2_1234 L B#(1, 14, 100, 120) L byte#(1,14,100,120) INT (Integer) 16 Decimal number signed -32768 to 32767 L 1 DINT (Integer, 32 bits) 32 Decimal number signed L#-2147483648 to L#2147483647 L L#1 REAL (Floating-point number) 32 IEEE Floating-point number Upper limit: 3.402823e+38 Lower limit: 1.175 495e-38 L 1.234567e+13 S5TIME (SIMATIC time) 16 S7 time in steps of 10 ms (default) S5T#0H_0M_0S_10MS to S5T#2H_46M_30S_0MS and S5T#0H_0M_0S_0MS L S5T#0H_1M_0S_0MS L S5TIME#0H_1H_1M_0S_0 MS TIME (IEC time) 32 IEC time in steps of 1 ms, integer signed - T#24D_20H_31M_23S_64 8MS to T#24D_20H_31M_23S_64 7MS L T#0D_1H_1M_0S_0MS L TIME#0D_1H_1M_0S_0MS DATE (IEC date) 16 IEC date in steps of 1 day D#1990-1-1 to D#2168-12-31 L D#1996-3-15 L DATE#1996-3-15 TIME_OF_DAY (Time) 32 Time in steps of 1 ms TOD#0:0:0.0 to TOD#23:59:59.999 L TOD#1:10:3.3 L TIME_OF_DAY#1:10:3.3 CHAR (Character) 8 ASCII characters 'A','B' etc. L 'E' Parameter Types In addition to elementary and complex data types, you can also define parameter types for formal parameters that are transferred between blocks. STEP 7 recognizes the following parameter types: • TIMER or COUNTER: this specifies a particular timer or particular counter that will be used when the block is executed. If you supply a value to a formal parameter of the TIMER or COUNTER parameter type, the corresponding actual parameter must be a timer or a counter, in other words, you enter "T" or "C" followed by a positive integer. • BLOCK: specifies a particular block to be used as an input or output. The declaration of the parameter determines the block type to be used (FB, FC, DB etc.). If you supply values to a formal parameter of the BLOCK parameter type, specify a block address as the actual parameter. Example: “FC101" (when using absolute addressing) or “Valve" (with symbolic addressing). Parameter Capacity Description TIMER 2. Byte s Indicates a timer to be used by the program in the called logic block. Format: T1 PAGE 16
  • 17. COUNTER 2 bytes Indicates a counter to be used by the program in the called logic block. Format: C10 BLOCK_FB BLOCK_FC BLOCK_DB BLOCK_SDB 2 bytes Indicates a block to be used by the program in the called logic block. Format: FC101 DB42 PAGE 17
  • 18. PROGRAMMING IN STATEMENT LIST What is Statement List? Statement List (STL) is a textual programming language that can be used to create the code section of logic blocks. Its syntax for statements is similar to assembler language and consists of instructions followed by addresses on which the instructions act. The Programming Language STL Of all the programming languages with which you can program S7 controllers, STL is the closest to the machine code MC7 of the S7 CPU. This means that by using it to program S7 controllers, you can optimize the run time and the use of memory. The programming language STL has all the necessary elements for creating a complete user program. It contains a comprehensive range of instructions. A total of over 130 different basic instructions and a wide range of addresses are available. Functions and function blocks allow you to structure your STL program clearly. The Programming Package The STL programming package is an integral part of the STEP 7 Standard Software. This means that following the installation of your STEP 7 software, all the editor functions, compiler functions and test/debug functions for STL are available to you. Using STL, you can create your own user program as follows: _ With the Incremental Editor. The input of the local data structure is made easier with the help of table editors. _ With a source file in the Text Editor. Text input is made easier with the help of block templates. There are three programming languages in the standard software, STL, FBD, and LAD. You can switch from one language to the other almost without restriction and choose the most suitable language for the particular block you are programming. If you write programs in LAD or FBD, you can always switch over to the STL representation. If you convert LAD programs into FBD programs and vice versa, program elements that cannot be represented in the destination language are displayed in STL. A STATEMENT CONSISTS OF AN INSTRUCTION AND AN ADDRESS Address of an Instruction The address of an instruction indicates a constant or the location where the instruction finds a value (data object) on which to perform an operation. The address can have a symbolic name or an absolute designation. The address can point to any of the following items : _ A constant, the value of a timer or counter, or an ASCII character string to be loaded into accumulator 1 (for example, L +27 See Table 2.1) _ A bit in the status word of the programmable logic controller _ A symbolic name (for example, A Motor.On, see Table 2-3) _ A data block and a location within the data block area (for example, L DB4.DBD10, see Table 2-4) _ A function (FC), function block (FB), integrated system function (SFC), or integrated system function block (SFB) and the number of the function or block (see Table 2-5) _ An address identifier and a location within the memory area that is indicated by the address identifier (for example, A I 1.0) PAGE 18
  • 25. COMMANDS USED IN STATEMENT LIST • Bit Logic Instructions ) Nesting Closed = Assign A And A( And with Nesting Open AN And Not AN( And Not with Nesting Open FN Edge Negative FP Edge Positive O Or O And before Or O( Or with Nesting Open ON Or Not ON( Or Not with Nesting Open R Reset S Set PAGE 25
  • 31. 31 Conversion Instructions AUTOMATION & CONTROL SYTEMS PAGE PUNE OFF: C-17,PAWANA IND. EST., T-204, MIDC - BHOSARI, PUNE-411026 MUMBAI OFF: 43, DATTANI CHAMBERS, NEAR NEW ERA THEATRE, S.V. ROAD, MALAD(W) MUMBAI-64 TEL.: 022-8883737
  • 32. BTD BCD to Double Integer (32-Bit) Example: L MD10 Load the BCD number into ACCU 1. BTD Convert from BCD to integer; store result in ACCU 1. T MD20 Transfer result (double integer number) to MD20. BTI BCD to Integer (16-Bit) Example: L MW10 Load the BCD number into ACCU 1-L. BTI Convert from BCD to integer; store result in ACCU 1-L. T MW20 Transfer result (integer number) to MW20. CAD Change Byte Sequence in ACCU 1 (32-Bit) Example: L MD10 Load the value of MD10 into ACCU 1. CAD Reverse the sequence of bytes in ACCU 1. T MD20 Transfer the results to MD20. Contents of ACCU 1 before execution of CAD: ACCU 1-H-H: ACCU 1-H-L: ACCU 1-L-H: ACCU 1-L-L: value "A" value "B" value "C" value "D" Contents of ACCU 1 after execution of CAD: ACCU 1-H-H: ACCU 1-H-L: ACCU 1-L-H: ACCU 1-L-L: value "D" value "C" value "B" value "A" PAGE 32
  • 33. CAW Change Byte Sequence in ACCU 1-L (16-Bit) Example: L MW10 Load the value of MW10 into ACCU 1. CAW Reverse the sequence of bytes in ACCU 1-L. T MW20 Transfer the result to MW20. Contents of ACCU 1 before execution of CAW: ACCU 1-H-H: ACCU 1-H-L: ACCU 1-L-H: ACCU 1-L-L: value "A" value "B" value "C" value "D" Contents of ACCU 1 after execution of CAW: ACCU 1-H-H: ACCU 1-H-L: ACCU 1-L-H: ACCU 1-L-L: value "A" value "B" value "D" value "C" DTB Double Integer (32-Bit) to BCD Example: L MD10 Load the 32-bit integer into ACCU 1. DTB Convert from integer (32-bit) to BCD, store result in ACCU 1. T MD20 Transfer result (BCD number) to MD20. PAGE 33
  • 34. DTR Double Integer (32-Bit) to Floating-Point Number (32-Bit, IEEE-FP) Example: L MD10 Load the 32-bit integer into ACCU 1. DTR Convert from double integer to floating point (32-bit IEEE FP); store result in ACCU 1. T MD20 Transfer result (BCD number) to MD20. INVD Ones Complement Double Integer (32-Bit) Example: Bit 31 16 15 0 Contents of ACCU 1 before execution of INVD 0110 1111 1000 1100 0110 0011 1010 1110 Contents of ACCU 1 after execution of INVD 1001 0000 0111 0011 1001 1100 0101 0001 L ID8 Load value into ACCU 1. INVD Form ones complement (32-bit). T MD10 Transfer result to MD10. PAGE 34
  • 35. INVI Ones Complement Integer (16-Bit) Example: Bit 15 0 Contents of ACCU 1-L before execution of INVI 0110 0011 1010 1110 Contents of ACCU 1-L after execution of INVI 1001 1100 0101 0001 L IW8 Load value into ACCU 1-L. INVI Form ones complement 16-bit. T MW10 Transfer result to MW10. ITB Integer (16-Bit) to BCD Example: L MW10 Load the integer number into ACCU 1-L. ITB Convert from integer to BCD (16-bit); store result in ACCU 1-L. T MW20 Transfer result (BCD number) to MW20. PAGE 35
  • 36. ITD Integer (16-Bit) to Double Integer (32-Bit) Example: L MW12 Load the integer number into ACCU 1. ITD Convert from integer (16-bit) to double integer (32-bit); store result in ACCU 1. T MD20 Transfer result (double integer) to MD20. MW12 = "-10" (Integer, 16-bit): ACCU 1-H ACCU 1-L Bit: 31 16 : 15 0 Contents of ACCU 1 before execution of ITD: XXXX XXXX XXXX XXXX 1111 1111 1111 0110 Contents of ACCU 1 after execution of ITD: 1111 1111 1111 1111 1111 1111 1111 0110 (X = 0 or 1, bits are not used for conversion) NEGD Twos Complement Double Integer (32-Bit) Example: ACCU 1-H ACCU 1-L Bit: 31 .0 Contents of ACCU 1 before execution of NEGD: 0101 1111 0110 0100 0101 1101 0011 1000 Contents of ACCU 1 after execution of NEGD: 1010 0000 1001 1011 1010 0010 1100 1000 L ID8 Load value into ACCU 1. NEGD Generate twos complement (32-bit). T MD10 Transfer result to MD10. PAGE 36
  • 37. NEGI Twos Complement Integer (16-Bit) Example: Bit 15 0 Contents of ACCU 1-L before execution of NEGI0101 1101 0011 1000 Contents of ACCU 1-L after execution of NEGI 1010 0010 1100 1000 L IW8 Load value into ACCU 1-L. NEGI Form twos complement 16-bit. T MW10 Transfer result to MW10. NEGR Negate Floating-Point Number (32-Bit, IEEE-FP) Example: L ID8 Load value into ACCU 1 (example: ID 8 = 1.5E+02). NEGR Negate floating-point number (32-bit, IEEE-FP); stores the result in ACCU 1. T MD10 Transfer result to MD10 (example: result = -1.5E+02). PAGE 37
  • 38. RND Round Example: L MD10 Load the floating-point number into ACCU 1-L. RND Convert the floating-point number (32-bit, IEEE-FP) into an integer (32-bit) and round off the result. T MD20 Transfer result (double integer number) to MD20. Value before conversion: Value after conversion: MD10 = "100.5" => RND => MD20 = "+100" MD10 = "-100.5" => RND => MD20 = "-100" PAGE 38
  • 39. RND+ Round to Upper Double Integer Example: L MD10 Load the floating-point number (32-bit, IEEE-FP) into ACCU 1-L. RND+ Convert the floating-point number (32-bit, IEEE-FP) to an integer (32-bit) and round result.Store output in ACCU 1. T MD20 Transfer result (double integer number) to MD20. Value before conversion: Value after conversion: MD10 = "100.5" => RND+ => MD20 = "+101" MD10 = "-100.5" => RND+ => MD20 = "-100" RND- Round to Lower Double Integer Example: L MD10 Load the floating-point number into ACCU 1-L. RND- Convert the floating-point number (32-bit, IEEE-FP) to an integer (32-bit) and round result.Store result in ACCU 1. T MD20 Transfer result (double integer number) to MD20. PAGE 39
  • 40. Value before conversion: Value after conversion: MD10 = "100.5" => RND- => MD20 = "+100" MD10 = "-100.5" => RND- => MD20 = "-101" TRUNC Truncate Example: L MD10 Load the floating-point number into ACCU 1-L. TRUNC Convert the floating-point number (32-bit, IEEE-FP) to an integer (32-bit) and round result.Store the result in ACCU 1. T MD20 Transfer result (double integer number) to MD20. Value before conversion: Value after conversion: MD10 = "100.5" => TRUNC => MD20 = "+100" MD10 = "-100.5" => TRUNC => MD20 = "-100" PAGE 40
  • 47. CD Counter Down Example: L C#14 Counter preset value. A I 0.1 Preset counter after detection of rising edge of I 0.1. S C1 Load counter 1 preset if enabled. A I 0.0 One count down per rising edge of I 0.0. CD C1 Decrement counter C1 by 1 when RL0 transitions from 0 to 1 depending on input I 0.0. AN C1 Zero detection using the C1 bit. = Q 0.0 Q 0.0 = 1 if counter 1 value is zero. CU Counter Up Example: A I 2.1 If there is a positive edge change at input I 2.1. CU C3 Counter C3 is incremented by 1 when RL0 transitions from 0 to 1. L Load Current Counter Value into ACCU 1 Example: L C3 Load ACCU 1-L with the count value of counter C3 in binary format. LC Load Current Counter Value into ACCU 1 as BCD Example: LC C3 Load ACCU 1-L with the count value of counter C3 in binary coded decimal format. R Reset Counter Example: A I 2.3 Check signal state at input I 2.3. R C3 Reset counter C3 to a value of 0 if RLO transitions from 0 to 1. S Set Counter Preset Value Example: A I 2.3 Check signal state at input I 2.3. L C#3 Load count value 3 into ACCU 1-L. S C1 Set counter C1 to count value if RLO transitions from 0 to 1 PAGE 47
  • 48. Data Block Instructions Format: OPN <data block> Example: OPN DB10 Open data block DB10 as a shared data block. L DBW35 Load data word 35 of the opened data block into ACCU 1-L. T MW22 Transfer the content of ACCU 1-L into MW22. OPN DI20 Open data block DB20 as an instance data block. L DIB12 Load data byte 12 of the opened instance data block into ACCU 1-L. T DBB37 Transfer the content of ACCU 1-L to data byte 37 of the opened shared data block. • Logic Control Instructions JC Jump if RLO = 1 Example: A I 1.0 A I 1.2 JC JOVR Jump if RLO=1 to jump label JOVR. L IW8 Program scan continues here if jump is not executed. T MW22 JOVR: A I 2.1 Program scan resumes here after jump to jump label JOVR. JCB Jump if RLO = 1 with BR Example: A I 1.0 A I 1.2 JCB JOVR Jump if RLO = 1 to jump label JOVR. Copy the contents of the RLO bit into the BR bit. L IW8 Program scan continues here if jump is not executed. T MW22 JOVR: A I 2.1 Program scan resumes here after jump to jump label JOVR. JCN Jump if RLO = 0 Example: A I 1.0 A I 1.2 JCN JOVR Jump if RLO = 0 to jump label JOVR. L IW8 Program scan continues here if jump is not executed. T MW22 JOVR: A I 2.1 Program scan resumes here after jump to jump label JOVR. JM Jump if Minus Example: L IW8 L MW12 -I //Subtract contents of MW12 from contents of IW8. PAGE 48 JM NEG //Jump if result < 0 (that is, contents of ACCU 1 < 0).
  • 49. AN M 4.0 //Program scan continues here if jump is not executed. S M 4.0 JU NEXT NEG: AN M 4.1 //Program scan resumes here after jump to jump label NEG. S M 4.1 NEXT: NOP 0 //Program scan resumes here after jump to jump label NEXT. JMZ Jump if Minus or Zero Example: L IW8 L MW12 -I Subtract contents of MW12 from contents of IW8. JMZ RGE0 Jump if result <=0 (that is, contents of ACCU 1 <= 0). AN M 4.0 Program scan continues here if jump is not executed. S M 4.0 JU NEXT RGE0: AN M 4.1 Program scan resumes here after jump to jump label RGE0. S M 4.1 NEXT: NOP 0 Program scan resumes here after jump to jump label NEXT. JN Jump if Not Zero Example: L IW8 L MW12 XOW JN NOZE Jump if the contents of ACCU 1-L are not equal to zero. AN M 4.0 Program scan continues here if jump is not executed. S M 4.0 JU NEXT NOZE: AN M 4.1 Program scan resumes here after jump to jump label NOZE. S M 4.1 NEXT: NOP 0 Program scan resumes here after jump to jump label NEXT. JP Jump if Plus Example: L IW8 L MW12 -I Subtract contents of MW12 from contents of IW8. JP POS Jump if result >0 (that is, ACCU 1 > 0). AN M 4.0 Program scan continues here if jump is not executed. S M 4.0 JU NEXT POS: AN M 4.1 Program scan resumes here after jump to jump label POS. S M 4.1 NEXT: NOP 0 Program scan resumes here after jump to jump label NEXT. JPZ Jump if Plus or Zero Example: L IW8 PAGE 49
  • 50. L MW12 -I Subtract contents of MW12 from contents of IW8. JPZ REG0 Jump if result >=0 (that is, contents of ACCU 1 >= 0). AN M 4.0 Program scan continues here if jump is not executed. S M 4.0 JU NEXT REG0: AN M 4.1 Program scan resumes here after jump to jump label REG0. S M 4.1 NEXT: NOP 0 Program scan resumes here after jump to jump label NEXT. JU Jump Unconditional Example: A I 1.0 A I 1.2 JC DELE Jump if RLO=1 to jump label DELE. L MB10 INC 1 T MB10 JU FORW Jump unconditionally to jump label FORW. DELE: L 0 T MB10 FORW: A I 2.1 Program scan resumes here after jump to jump label FORW. JUO Jump if Unordered Example: L MD10 L ID2 /D Divide contents of MD10 by contents of ID2. JUO ERRO Jump if division by zero (that is, ID2 = 0). T MD14 Program scan continues here if jump is not executed. A M 4.0 R M 4.0 JU NEXT ERRO: AN M 4.0 Program scan resumes here after jump to jump label ERRO. S M 4.0 NEXT: NOP 0 Program scan resumes here after jump to jump label NEXT. JZ Jump if Zero Example: L MW10 SRW 1 JZ ZERO Jump to jump label ZERO if bit that has been shifted out = 0. L MW2 Program scan continues here if jump is not executed. INC 1 T MW2 JU NEXT ZERO: L MW4 Program scan resumes here after jump to jump label ZERO. INC 1 T MW4 NEXT: NOP 0 Program scan resumes here after jump to jump label NEXT. PAGE 50
  • 51. LOOP Loop Example for calculating the factor of 5: L L#1 Load the integer constant (32 bit) into ACCU 1. T MD20 Transfer the contents from ACCU 1 into MD20 (initialization). L 5 Load number of loop cycles into ACCU 1-L. NEXT: T MW10 Jump label = loop start / transfer ACCU 1-L to loop counter. L MD20 * D Multiply current contents of MD20 by the current contents of MB10. T MD20 Transfer the multiplication result to MD20. L MW10 Load contents of loop counter into ACCU 1. LOOP NEXT Decr. the contents of ACCU 1 and jump to the NEXT jump label if ACCU 1-L > 0. L MW24 Program scan resumes here after loop is finished. L 200 >I • Load and Transfer Instructions L Load L <address> loads the addressed byte, word, or double word into ACCU 1 after the old contents of ACCU 1 have been saved into ACCU 2, and ACCU 1 is reset to "0". Example: L IB10 Load input byte IB10 into ACCU 1-L-L. L MB120 Load memory byte MB120 into ACCU 1-L-L. L DBB12 Load data byte DBB12 into ACCU 1-L-L. L DIW15 Load instance data word DIW15 into ACCU 1-L. L LD252 Load local data double word LD252 ACCU 1. T Transfer T <address> transfers (copies) the contents of ACCU 1 to the destination address if the Master Control Relay is switched on (MCR = 1). If MCR = 0, then the destination address is written with 0. The number of bytes copied from ACCU 1 depends on the size expressed in the destination address. ACCU 1 also saves the data after the transfer procedure. A transfer to the direct I/O area (memory type PQ) also transfers the contents of ACCU 1 or "0" (if MCR=0) to the corresponding address of the process image output table (memory type Q). The instruction is executed without regard to, and without affecting, the status bits. Example: T QB10 Transfers contents of ACCU 1-L-L to output byte QB10. T MW14 Transfers contents of ACCU 1-L to memory word MW14. T DBD2 Transfers contents of ACCU 1 to data double word DBD2. PAGE 51
  • 52. • Floating-Point Math Instructions; Basic *R Multiply ACCU 1 and ACCU 2 as Floating Point Numbers (32-Bit IEEE-FP) Example: OPN DB10 L ID10 Load the value of ID10 into ACCU 1. L MD14 Load the value of ACCU 1 into ACCU 2.Load the value of MD14 into ACCU 1. *R Multiply ACCU 2 and ACCU 1; store the result in ACCU 1. T DBD25 The content of ACCU 1 (result) is transferred to DBD25 in DB10. +R Add ACCU 1 and ACCU 2 as a Floating Point Number (32-Bit IEEE-FP) Example: OPN DB10 L ID10 Load the value of ID10 into ACCU 1. L MD14 Load the value of ACCU 1 into ACCU 2.Load the value of MD14 into ACCU 1. +R Add ACCU 2 and ACCU 1; store the result in ACCU 1. T DBD25 The content of ACCU 1 (result) is transferred to DBD25 in DB10. -R Subtract ACCU 1 from ACCU 2 as a Floating Point Number (32-Bit IEEE-FP) Example: OPN DB10 L ID10 Load the value of ID10 into ACCU 1. L MD14 Load the value of ACCU 1 into ACCU 2.Load the value of MD14 into ACCU 1. -R Subtract ACCU 1 from ACCU 2; store the result in ACCU 1. T DBD25 The content of ACCU 1 (result) is transferred to DBD25 in DB10. /R Divide ACCU 2 by ACCU 1 as a Floating Point Number (32-Bit IEEE-FP) Example: OPN DB10 L ID10 Load the value of ID10 into ACCU 1. L MD14 Load the contents of ACCU 1 into ACCU 2.Load the value of MD14 into ACCU 1. /R Divide ACCU 2 by ACCU 1; store the result in ACCU 1. T DBD20 The content of ACCU 1 (result) is transferred to DBD20 in DB10. ABS Absolute Value of a Floating Point Number (32-Bit IEEE-FP) Example: L ID8 Load value into ACCU 1 (example: ID8 = -1.5E+02). ABS Form the absolute value; store the result in ACCU 1. T MD10 Transfer result to MD10 (example: result = 1.5E+02). PAGE 52
  • 54. Integer Math Instructions + Add Integer Constant (16, 32 Bit) + <integer constant> adds the integer constant to the contents of ACCU 1 and stores the result in ACCU 1. The instruction is executed without regard to, and without affecting, the status word bits. The contents of accumulator 2 remain unchanged for CPUs with two ACCUs. The contents of accumulator 3 are copied into accumulator 2, and the contents of accumulator 4 are copied into accumulator 3 for CPUs with four ACCUs. The contents of accumulator 4 remain unchanged. + <16-bit integer constant>: Adds a 16-bit integer constant (in the range of -32768 to +32767) to the contents of ACCU 1-L and stores the result in ACCU 1-L. The contents of accumulator 2 remain unchanged for CPUs with two ACCUs. The contents of accumulator 3 are copied into accumulator 2, and the contents of accumulator 4 are copied into accumulator 3 for CPUs with four ACCUs. The contents of accumulator 4 remain unchanged. + <32-bit integer constant>: Adds a 32-bit integer constant (in the range of -2,147,483,648 to 2,147,483,647) to the contents of ACCU 1 and stores the result in ACCU 1. The contents of accumulator 2 remain unchanged for CPUs with two ACCUs. The contents of accumulator 3 are copied into accumulator 2, and the contents of accumulator 4 are copied into accumulator 3 for CPUs with four ACCUs. The contents of accumulator 4 remain unchanged. Example 1: L IW10 Load the value of IW10 into ACCU 1-L. L MW14 Load the contents of ACCU 1-L to ACCU 2-L. Load the value of MW14 into ACCU 1-L. +I Add ACCU 2-L and ACCU 1-L; store the result in ACCU 1-L. + 25 Add ACCU 1-L and 25; store the result in ACCU 1-L. T DB1.DBW25 Transfer the contents of ACCU 1-L (result) to DBW25 of DB1. Example 2: L IW12 L IW14 + 100 Add ACCU 1-L and 100; store the result in ACCU 1-L. >I If ACCU 2 > ACCU 1, or IW12 > (IW14 + 100) JC NEXT then conditional jump to jump label NEXT. Example 3: L MD20 L MD24 +D Add ACCU 1and ACCU 2; store the result in ACCU 1. + L#-200 Add ACCU 1 and -200; store the result in ACCU 1. T MD28 +D Add ACCU 1 and ACCU 2 as Double Integer (32-Bit) Example: L ID10 Load the value of ID10 into ACCU 1. L MD14 Load the contents of ACCU 1 to ACCU 2.Load the value of MD14 into ACCU 1. +D Add ACCU 2 and ACCU 1; store the result in ACCU 1. T DB1.DBD25 The contents of ACCU 1 (result) are transferred to DBD25 of DB1. PAGE 54
  • 55. -D Subtract ACCU 1 from ACCU 2 as Double Integer (32-Bit) Example: L ID10 Load the value of ID10 into ACCU 1. L MD14 Load the contents of ACCU 1 into ACCU 2.Load the value of MD14 into ACCU 1. -D Subtract ACCU 1 from ACCU 2; store the result in ACCU 1. T DB1.DBD25 The contents of ACCU 1 (result) are transferred to DBD25 of DB1. *D Multiply ACCU 1 and ACCU 2 as Double Integer (32-Bit) Example: L ID10 Load the value of ID10 into ACCU 1. L MD14 Load contents of ACCU 1 into ACCU 2.Load contents of MD14 into ACCU 1. *D Multiply ACCU 2 and ACCU 1; store the result in ACCU 1. T DB1.DBD25 The contents of ACCU 1 (result) are transferred to DBD25 in DB1. /D Divide ACCU 2 by ACCU 1 as Double Integer (32-Bit) Example: L ID10 Load the value of ID10 into ACCU 1. L MD14 Load the contents of ACCU 1 into ACCU 2.Load the value of MD14 into ACCU 1. /D Divide ACCU 2 by ACCU 1; store the result (quotient) in ACCU 1. T MD20 The contents of ACCU 1 (result) are transferred to MD20. Example above: 13 divided by 4 Contents of ACCU 2 before instruction (ID10): "13" Contents of ACCU 1 before instruction (MD14): "4" Instruction /D (ACCU 2 / ACCU 1) : "13/4" Contents of ACCU 1 after instruction (quotient): "3" +I Add ACCU 1 and ACCU 2 as Integer (16-Bit) Example: L IW10 Load the value of IW10 into ACCU 1-L. L MW14 Load the contents of ACCU 1-L into ACCU 2-L.Load the value of MW14 into ACCU 1-L. +I Add ACCU 2-L and ACCU 1-L; store the result in ACCU 1-L. T DB1.DBW25 The contents of ACCU 1-L (result) are transferred to DBW25 of DB1. -I Subtract ACCU 1 from ACCU 2 as Integer (16-Bit) Example: L IW10 Load the value of IW10 into ACCU 1-L. L MW14 Load the contents of ACCU 1-L into ACCU 2-L.Load the value of MW14 into ACCU 1-L. -I Subtract ACCU 1-L from ACCU 2-L; store the result in ACCU 1-L. T DB1.DBW25 The contents of ACCU 1-L (result) are transferred to DBW25 of DB1. *I Multiply ACCU 1 and ACCU 2 as Integer (16-Bit) Example: PAGE 55
  • 56. L IW10 Load the value of IW10 into ACCU 1-L. L MW14 Load contents of ACCU 1-L into ACCU 2-L.Load contents of MW14 into ACCU 1- L. *I Multiply ACCU 2-L and ACCU 1-L, store result in ACCU 1. T DB1.DBD25 The contents of ACCU 1 (result) are transferred to DBW25 in DB1. /I Divide ACCU 2 by ACCU 1 as Integer (16-Bit) Example: L IW10 Load the value of IW10 into ACCU 1-L. L MW14 Load the contents of ACCU 1-L into ACCU 2-L.Load the value of MW14 into ACCU 1-L. /I Divide ACCU 2-L by ACCU 1-L; store the result in ACCU 1:ACCU 1-L: quotient, ACCU 1-H: remainder T MD20 The contents of ACCU 1 (result) are transferred to MD20. Example above: 13 divided by 4 Contents of ACCU 2-L before instruction (IW10):"13" Contents of ACCU 1-L before instruction (MW14): "4" Instruction /I (ACCU 2-L / ACCU 1-L): "13/4" Contents of ACCU 1-L after instruction (quotient): "3" Contents of ACCU 1-H after instruction (remainder): "1" MOD Division Remainder Double Integer (32-Bit) Example: L ID10 Load the value of ID10 into ACCU 1. L MD14 Load the contents of ACCU 1 into ACCU 2.Load the value of MD14 into ACCU 1. MOD Divide ACCU 2 by ACCU 1, store the result (remainder) in ACCU 1. T MD20 The contents of ACCU 1 (result) are transferred to MD20. Example above : 13 divided by 4 Contents of ACCU 2 before instruction (ID10): "13" Contents of ACCU 1 before instruction (MD14): "4" Instruction MOD (ACCU 2 / ACCU 1): "13/4" Contents of ACCU 1 after instruction (remainder): "3" PAGE 56
  • 57. Program Control Instructions BE Block End BE (block end) terminates the program scan in the current block and causes a jump to the block that called the current block. The program scan resumes with the first instruction that follows the block call statement in the calling program. BEC Block End Conditional If RLO = 1, then BEC (block end conditional) interrupts the program scan in the current block and causes a jump to the block that called the current block. Example: A I 1.0 Update RLO. BEC End block if RLO = 1. L IW4 Continue here if BEC is not executed, RLO = 0. T MW10 BEU Block End Unconditional BEU (block end unconditional) terminates the program scan in the current block and causes a jump to the block that called the current block. The program scan resumes with the first instruction that follows the block call. Example: A I 1.0 JC NEXT Jump to NEXT jump label if RLO = 1 (I 1.0 = 1). L IW4 Continue here if no jump is executed. T IW10 A I 6.0 A I 6.1 S M 12.0 BEU Block end unconditional. NEXT: NOP 0 Continue here if jump is executed. CALL Block Call CALL <logic block identifier> is used to call functions (FCs) or function blocks (FBs), system functions (SFCs) or system function blocks (SFBs) you created yourself or to call the standard pre-programmed blocks shipped by Siemens. The CALL instruction calls the FC and SFC or the FB and SFB that you input as an address, independent of the RLO or any other condition. Example: CALL FB1, DB1 or CALL FILLVAT1, RECIPE1 Logic Block Block Type Absolute Address Call Syntax FC Function CALL FCn SFC System function CALL SFCn FB Function block CALL FBn1,DBn2 SFB System function block CALL SFBn1,DBn2 Example 1: Assigning parameters to the FC6 call CALL FC6 Formal parameter Actual parameter NO OF TOOL := MW100 TIME OUT := MW110 FOUND:= Q 0.1 PAGE 57
  • 58. ERROR := Q 100.0 Example 2: Calling an SFC without parameters CALL SFC43 Call SFC43 to re-trigger watchdog timer (no parameters). Example 3: Calling FB99 with instance data block DB1 CALL FB99,DB1 Formal parameter Actual parameter MAX_RPM := #RPM1_MAX MIN_RPM := #RPM2 MAX_POWER := #POWER MAX_TEMP := #TEMP Example 4: Calling FB99 with instance data block DB2 CALL FB99,DB2 Formal parameter Actual parameter MAX_RPM := #RPM3_MAX MIN_RPM := #RPM2 MAX_POWER := #POWER1 MAX_TEMP := #TEMP CC Conditional Call CC <logic block identifier> (conditional block call) calls a logic block if RLO=1. CC is used to call logic blocks of the FC or SFC type without parameters. Example: A I 2.0 Check signal state at input I 2.0. CC FC6 Call function FC6 if I 2.0 is "1". A M 3.0 Executed upon return from called function (I 2.0 = 1) or directly after A I 2.0 statement if I 2.0 = 0. UC Unconditional Call UC <logic block identifier> (unconditional block call) calls a logic block of the FC or SFC type. UC is like the CALL instruction, except that you cannot transfer parameters with the called block. Example 1: UC FC6 Call function FC6 (without parameters). Example 2: UC SFC43 Call system function SFC43 (without parameters). PAGE 58
  • 59. Shift Instructions SLD Shift Left Double Word (32-Bit) SLD <number>: The number of shifts is specified by the address <number>. The permissible value range is from 0 to 32. The status word bits CC 0 and OV are reset to zero if <number> is greater than zero. If <number> is equal to zero, then the shift instruction is regarded as a NOP operation. Examples: ACCU 1-H ACCU 1-L Bit: 31 16 15 0 ACCU 1 before execution of SLD 5: 0101 1111 0110 0100 0101 1101 0011 1011 ACCU 1 after execution of SLD 5: 1110 1100 1000 1011 1010 0111 0110 0000 Example 1: L MD4 Load value into ACCU 1. SLD 5 Shift bits in ACCU 1 five places to the left. T MD8 Transfer result to MD8. SLW Shift Left Word (16-Bit) SLW <number>: The number of shifts is specified by the address <number>. The permissible value range is from 0 to 15. The status word bits CC 0 and OV are reset to zero if <number> is greater than zero. If <number> is equal to zero, then the shift instruction is regarded as a NOP operation. Examples: ACCU 1-H ACCU 1-L Bit: 31 16 15 0 ACCU 1 before execution of SLW 5: 0101 1111 0110 0100 0101 1101 0011 1011 ACCU 1 after execution of SLW 5: 0101 1111 0110 0100 1010 0111 0110 0000 Example 1: L MW4 Load value into ACCU 1. SLW 5 Shift the bits in ACCU 1 five places to the left. T MW8 Transfer result to MW8. SRD Shift Right Double Word (32-Bit) SRD <number>: The number of shifts is specified by the address <number>. The permissible value range is from 0 to 32. The status word bits CC 0 and OV are reset to 0 if <number> is greater thnan zero. Examples: ACCU 1-H ACCU 1-L Bit: 31 16 15 0 ACCU 1 before execution of SRD 7:0101 1111 0110 0100 0101 1101 0011 1011 ACCU 1 after execution of SRD 7: 0000 0000 1011 1110 1100 1000 1011 1010 Example 1: L MD4 Load value into ACCU 1. SRD 7 Shift bits in ACCU 1 seven places to the right. T MD8 Transfer result to MD8. SRW Shift Right Word (16-Bit) SRW <number>: The number of shifts is specified by the address <number>. The permissible value range is from 0 to 15. The status word bits CC 0 and OV are reset to 0 if <number> is greater than zero. PAGE 59
  • 60. Examples: ACCU 1-H ACCU 1-L Bit: 31 16 15 0 ACCU 1 before execution of SRW 6: 0101 1111 0110 0100 0101 1101 0011 1011 ACCU 1 after execution of SRW 6: 0101 1111 0110 0100 0000 0001 0111 0100 Example 1: L MW4 Load value into ACCU 1. SRW 6 Shift bits in ACCU 1-L six places to the right. T MW8 Transfer result to MW8. PAGE 60
  • 62. SD On-Delay Timer SD <timer> starts the addressed timer when the RLO transitions from "0" to "1". The programmed time interval elapses as long as RLO = 1. The time is stopped if RLO transitions to "0" before the programmed time interval has expired. This timer start instruction expects the time value and the time base to be stored as a BCD number in ACCU 1-L. Example: A I 2.1 L S5T#10s Preset 10 seconds into ACCU 1. SD T1 Start timer T1 as an on-delay timer. PAGE 62
  • 64. SE Extended Pulse Timer SE <timer> starts the addressed timer when the RLO transitions from "0" to "1". The programmed time interval elapses, even if the RLO transitions to "0" in the meantime. The programmed time interval is started again if RLO transitions from "0" to "1" before the programmed time has expired. This timer start command expects the time value and the time base to be stored as a BCD number in ACCU 1-L. Example: A I 2.1 L S5T#10s Preset 10 seconds into ACCU 1. SE T1 Start timer T1 as an extended pulse timer. A I 2.2 R T1 Reset timer T1. A T1 Check signal state of timer T1. = Q 4.0 PAGE 64
  • 66. SF Off-Delay Timer SF <timer> starts the addressed timer when the RLO transitions from "1" to "0". The programmed time elapses as long as RLO = 0. The time is stopped if RLO transitions to "1" before the programmed time interval has expired. This timer start command expects the time value and the time base to be stored as a BCD number in ACCU 1-L. Example: A I 2.1 L S5T#10s Preset 10 seconds into ACCU 1. SF T1 Start timer T1 as an off-delay timer. A I 2.2 R T1 Reset timer T1. A T1 Check signal state of timer T1. = Q 4.0 PAGE 66
  • 68. SP Pulse Timer SP <timer> starts the addressed timer when the RLO transitions from "0" to "1". The programmed time elapses as long as RLO = 1. The timer is stopped if RLO transitions to "0" before the programmed time interval has expired. This timer start command expects the time value and the time base to be stored as a BCD number in ACCU 1-L. Example: A I 2.1 L S5T#10s Preset 10 seconds into ACCU 1. SP T1 Start timer T1 as a pulse timer. A I 2.2 R T1 Reset timer T1. A T1 Check signal state of timer T1. = Q 4.0 PAGE 68
  • 70. SS Retentive On-Delay Timer SS <timer> (start timer as a retentive ON timer) starts the addressed timer when the RLO transitions from "0" to "1". The full programmed time interval elapses, even if the RLO transitions to "0" in the meantime. The programmed time interval is re-triggered (started again) if RLO transitions from "0" to "1" before the programmed time has expired. This timer start command expects the time value and the time base to be stored as a BCD number in ACCU 1-L. Example: A I 2.1 L S5T#10s Preset 10 seconds into ACCU 1. SS T1 Start timer T1 as a retentive on-delay timer. A I 2.2 R T1 Reset timer T1. A T1 Check signal state of timer T1. = Q 4.0 PAGE 70
  • 73. R Reset Timer R <timer> stops the current timing function and clears the timer value and the time base of the addressed timer word if the RLO transitions from 0 to 1. Example: A I 2.1 R T1 Check the signal state of input I 2.1 If RLO transitioned from 0 = 1, then reset timer T1. PAGE 73
  • 74. Word Logic Instructions AD AND Double Word (32-Bit) AD (AND double word) combines the contents of ACCU 1 with ACCU 2 or a 32-bit constant bit by bit according to the Boolean logic operation AND. A bit in the result double word is "1" only when the corresponding bits of both double words combined in the logic operation are "1". Examples: Bit: 31 Bit:0 ACCU 1 before execution of AD: 0101 0000 1111 1100 1000 1001 0011 1011 ACCU 2 or 32-bit constant: 1111 0011 1000 0101 0111 0110 1011 0101 Result (ACCU 1) after execution of AD:0101 0000 1000 0100 0000 0000 0011 0001 L ID20 Load contents of ID20 into ACCU 1. L ID24 Load contents of ACCU 1 into ACCU 2.Load contents of ID24 into ACCU 1. AD Combine bits from ACCU 1 with ACCU 2 by AND, store result in ACCU 1. T MD8 Transfer result to MD8. AW AND Word (16-Bit) AW (AND word) combines the contents of ACCU 1-L with ACCU 2-L or a 16 bit-constant bit by bit according to the Boolean logic operation AND. A bit in the result word is "1" only when the corresponding bits of both words combined in the logic operation are "1". Examples: Bit: 15 Bit:0 ACCU 1-L before execution of AW: 0101 1001 0011 1011 ACCU 2-L or 16-bit constant: 1111 0110 1011 0101 Result (ACCU 1-L) after execution of AW: 0101 0000 0011 0001 L IW20 Load contents of IW20 into ACCU 1-L. L IW22 Load contents of ACCU 1 into ACCU 2.Load contents of IW22 into ACCU 1-L. AW Combine bits from ACCU 1-L with ACCU 2-L bits by AND; store result in ACCU 1-L. T MW 8 Transfer result to MW8. OD OR Double Word (32-Bit) OD (OR double word) combines the contents of ACCU 1 with ACCU 2 or a 32-bit constant bit by bit according to the Boolean logic operation OR. A bit in the result double word is "1" when at least one of the corresponding bits of both double words combined in the logic operation is "1". Examples: Bit: 31 Bit:0 ACCU 1 before execution of OD: 0101 0000 1111 1100 1000 0101 0011 1011 ACCU 2 or 32-bit constant: 1111 0011 1000 0101 0111 0110 1011 0101 Result (ACCU 1) after execution of OD:1111 0011 1111 1101 1111 0111 1011 1111 L ID20 Load contents of ID20 into ACCU 1. L ID24 Load contents of ACCU 1 into ACCU 2.Load contents of ID24 into ACCU 1. OD Combine bits from ACCU 1 with ACCU 2 bits by OR; store result in ACCU 1. T MD8 Transfer result to MD8. OW OR Word (16-Bit) PAGE 74
  • 75. OW (OR word) combines the contents of ACCU 1-L with ACCU 2-L or a 16 bit-constant bit by bit according to the Boolean logic operation OR. A bit in the result word is "1" when at least one of the corresponding bits of both words combined in the logic operation is "1". Examples: Bit: 15 Bit:0 ACCU 1-L before execution of OW: 0101 0101 0011 1011 ACCU 2-L or 16 bit constant: 1111 0110 1011 0101 Result (ACCU 1-L) after execution of OW: 1111 0111 1011 1111 L IW20 Load contents of IW20 into ACCU 1-L. L IW22 Load contents of ACCU 1 into ACCU 2.Load contents of IW22 into ACCU 1-L. OW Combine bits from ACCU 1-L with ACCU 2-L by OR, store result in ACCU 1-L. T MW8 Transfer result to MW8. XOD Exclusive OR Double Word (32-Bit) XOD (XOR double word) combines the contents of ACCU 1 with ACCU 2 or a 32-bit constant bit by bit according to the Boolean logic operation XOR (Exclusive Or). A bit in the result double word is "1" when only one of the corresponding bits of both double words combined in the logic operation is "1". Examples: Bit: 31 Bit:0 ACCU 1 before execution of XOD: 0101 0000 1111 1100 1000 0101 0011 1011 ACCU 2 or 32-bit constant: 1111 0011 1000 0101 0111 0110 1011 0101 Result (ACCU 1) after execution of OD:1010 0011 0111 1001 1111 0011 1000 1110 L ID20 Load contents of ID20 into ACCU 1. L ID24 Load contents of ACCU 1 into ACCU 2.Load contents of ID24 into ACCU 1. XOD Combine bits from ACCU 1 with ACCU 2 by XOR; store result in ACCU 1. T MD8 Transfer result to MD8. XOW Exclusive OR Word (16-Bit) XOW (XOR word) combines the contents of ACCU 1-L with ACCU 2-L or a 16 bit-constant bit by bit according to the Boolean logic operation XOR. A bit in the result word is "1" only when one of the corresponding bits of both words combined in the logic operation is "1". Examples: Bit: 15 Bit:0 ACCU 1 before execution of XOW: 0101 0101 0011 1011 ACCU 2-L or 16-bit constant: 1111 0110 1011 0101 Result (ACCU 1) after execution of XOW: 1010 0011 1000 1110 L IW20 Load contents of IW20 into ACCU 1-L. L IW22 Load contents of ACCU 1 into ACCU 2.Load contents of ID24 into ACCU 1-L. XOW Combine bits of ACCU 1-L with ACCU 2-L bits by XOR, store result in ACCU 1-L. T MW8 Transfer result to MW8. PAGE 75
  • 76. Accumulator Instructions DEC Decrement ACCU 1-L-L Example: L MB250 Load the value of MB250 DEC 1 Instruction "Decrement ACCU 1-L-L by 1"; store result in ACCU 1-L-L. T MB250 Transfer the contents of ACCU 1-L-L (result) back to MB250. INC Increment ACCU 1-L-L Example: L MB22 Load the value of MB22 INC 1 Instruction "Increment ACCU 1 (MB22) by 1"; store result in ACCU 1-L-L T MB22 Transfer the contents of ACCU 1-L-L (result) back to MB22 TAK Toggle ACCU 1 with ACCU 2 Example: Subtract smaller value from greater value: Example: L MW10 Load contents of MW10 into ACCU 1-L. L MW12 Load contents of ACCU 1-L into ACCU 2-L.Load contents of MW12 into ACCU 1- >I Check if ACCU 2-L (MW10) greater than ACCU 1-L (MW12). JC NEXT Jump to NEXT jump label if ACCU 2 (MW10) is greater than ACCU 1 (MW12). TAK Swap contents ACCU 1 and ACCU 2 NEXT: -I Subtract contents of ACCU 2-L from contents of ACCU 1-L. T MW14 Transfer result (= greater value minus smaller value) to MW14. PAGE 76
  • 85. AUTOMATION & CONTROL SYTEMS PAGE 85 PUNE OFF: C-17,PAWANA IND. EST., T-204, MIDC - BHOSARI, PUNE-411026 MUMBAI OFF: 43, DATTANI CHAMBERS, NEAR NEW ERA THEATRE, S.V. ROAD, MALAD(W) MUMBAI-64 TEL.: 022-8883737 AUTOMATION & CONTROL SYTEMS PAGE 85 PUNE OFF: C-17,PAWANA IND. EST., T-204, MIDC - BHOSARI, PUNE-411026 MUMBAI OFF: 43, DATTANI CHAMBERS, NEAR NEW ERA THEATRE, S.V. ROAD, MALAD(W) MUMBAI-64 TEL.: 022-8883737