Siemens 7 Bedienungsanleitung Seite 119

  • Herunterladen
  • Zu meinen Handbüchern hinzufügen
  • Drucken
  • Seite
    / 164
  • Inhaltsverzeichnis
  • LESEZEICHEN
  • Bewertet. / 5. Basierend auf Kundenbewertungen
Seitenansicht 118
Publication LOGIX-AP008B-EN-P - June 2008 119
Conversion of Typical Program Structures Chapter 4
It reads and evaluates an expression string that is stored in a data block. It has
a limitation compared with Logix CPT - the expression is written in reverse
Polish notation, which will not suit everyone.
The main problems with writing a function block such as this are that it takes
time and is not for beginning programmers. With Logix, the CPT instruction is
available for everyone to use as soon as RSLogix 5000 software is installed.
Type Checking
With both STEP 7 and Logix, parameters to Functions, Function Blocks,
Instructions and Add-On Instructions are strictly type-checked by their
compilers.
There are differences with mathematical expressions.
Logix distinguishes between Numeric and Boolean values. The compiler will
reject expressions that illogically mix numeric and boolean values. When it
encounters expressions of mixed numeric type, it will make conversions to
produce a result of the type of the declared result variable. Hence it will
interpret * as integer multiplication if the result is to be an integer and as real
multiplication if the result is to be a real.
In STEP 7 the type of arithmetic operations must be specified. There are for
example *I (multiply two 16 bit integers) *D (multiply two 32 bit integer) and
*R (multiply two reals). It is up to the programmer to ensure that the two
numbers that are the operands of a *R instruction are reals. If they are not, the
compiler will not complain but the result will be nonsense.
Conclusion
The Logix methods of programming mathematical expressions are clearer, and
by separating math code from other logic, will simplify testing and validation.
Seitenansicht 118
1 2 ... 114 115 116 117 118 119 120 121 122 123 124 ... 163 164

Kommentare zu diesen Handbüchern

Keine Kommentare