EasyManua.ls Logo

SEW-Eurodrive IPOS plus - Iposplus Variables in the Compiler; Example; Declaration of Global Variables

SEW-Eurodrive IPOS plus
384 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
Manual – IPOSplus®
191
14
IPOSplus
®
variables in the Compiler
Compiler – Programming
14.16 IPOS
plus®
variables in the Compiler
The IPOS
plus®
variables are practically an element of the language and are not allowed
to be declared explicitly. They all have the same data type (32 bit with sign) and are valid
globally throughout the entire source text. The following line is present implicitly in each
module:
To identify variables symbolically, the #define or #declare directives can be used to de-
fine a symbolic name.
14.16.1 Example
#define TESTVAR1 H73 //H73 has the symbolic name "TESTVAR1"
H73 is then assigned the value 134 in the program from one of 3 assignments:
TESTVAR1 = 134;
TESTVAR1 = 0x86;
TESTVAR1 = 0b10000110;
14.17 Declaration of global variables
Another option is to declare global variables with the long key word as already explained
above. The Compiler then automatically defines the numbers of the variables (see
#pragma). The variable numbers are assigned in ascending order according to where
the variable declarations occur in the source text. A declaration starts with the key word
long, followed by the list of symbolic identifiers separated by commas. The declaration
ends with a semicolon. The declaration can be spread over several source text lines.
A global variable can be declared anywhere in the program, provided it is outside of
blocks (generally functions). For reasons of clarity, variables should be declared at the
start of the source text module. A global variable must also be declared before it is used.
Examples:
The Compiler assigns variables H420 to H424 to the identifiers a, b, this_is_a_variable,
c and d. In the following example, the '#pragma globals' directive instructs the Compiler
to assign variables H150 to H160 to the identifiers.
long H0, H1, H2, H3, ... , H1023.
long a, b; // Variables are available in the range
long this_is_a_variable;// defined for global variables
long c, d;
#pragma globals 150 160
long a, b;
long this_is_a_variable;
long c, d;
P
i
f
kVA
Hz
n
P
i
f
kVA
Hz
n

Table of Contents