Selecting Between Simatic And Iec 1131-3 Programming Modes; Overloaded Instructions; Example Of Iec Overloaded Add Instruction - Siemens SIMATIC S7-200 System Manual

Hide thumbs Also See for SIMATIC S7-200:
Table of Contents

Advertisement

Selecting Between SIMATIC and IEC 1131-3 Programming Modes

Since IEC 1131-3 is strongly data typed, and SIMATIC is not strongly data typed,
STEP 7-Micro/WIN 32 does not allow you to move programs between the two
different editing modes. You must choose a preferred editing mode.

Overloaded Instructions

Overloaded instructions support a range of data types. Strong data type checking
is still applied since all of the operand data types must match before the instruction
compiles successfully. Table 4-7 shows an example of the IEC overloaded ADD
instruction.
Table 4-7

Example of IEC Overloaded ADD Instruction

Instruction
Allowed Data Types
(Strong Data Type Checking)
ADD
ADD
ADD
When all of the operands have the data type DINT, an Add Double Integer
instruction will be generated by the compiler. A compilation error occurs if data
types are mixed for the overloaded instruction. What is considered illegal depends
on the level of data type checking. The following example will generate a compiler
error under strong data type checking, but will pass compile for simple data type
checking.
ADD IN1 = INT, IN2 = WORD, IN3 = INT
Strong data type checking: compile error
Data type checking: compiles to ADD_I (Add Integer)
The simple data type checking will not prevent common run-time programming
errors from occurring. With simple data type checking, the compiler will not catch
the following common programming errors: ADD 40000, 1 will be a negative
number, not an unsigned 40,001.
S7-200 Programmable Controller System Manual
A5E00066097-02
Basic Concepts for Programming an S7-200 CPU
Allowed Data Types
(Data Type Checking)
INT
DINT
DWORD, DINT
REAL
Compiled Instruction
WORD, INT
ADD_I (Add Integer)
ADD_D (Add Double Integer)
REAL
ADD_R (Add Real)
4-15

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents