KEP MMI-1500 Installation & Operation Manual page 191

Mmi-touchscreen series
Table of Contents

Advertisement

14.3.1.2 Variables
Variables are names that represent information. The information can change as the variable is modified by statements.
Naming rules for Variables:
1.
All variable names must start with an alphabet
character. Other characters in the variable can
be characters or numbers.
2.
Punctuation, the "_" character, spaces and non-
alphanumeric characters cannot be used in
variable names.
3.
Variable names longer than 32 characters are
not allowed.
4.
Reserved words cannot be used as Variable
names.
There are 5 different variable types:
Type
Description
1 bit (discrete) variable
bool
8 bit (byte) variable
char
16 bit (word) variable
short
32 bit (double word) variable
int
32 bit (floating point) variable
float
Declaring Variables
Variables must be declared before being used. All variable declarations must be made before any other statements in the
macro. To declare a variable, specify the type then the variable name.
Example of a simple declaration
If there more than a single variable of a particular type is needed, they can be declared in the same statement by separating
them with commas.
Example of multiple variable declaration
Declaring Arrays
Macros support one-dimensional arrays. To declare an array of variables, specify the type, the variable name then the
number of variables in the array enclosed in brackets "[ ]". Arrays are 1 to 4096 variables in length. (Macros only support up
to 4096 variables per macro)
Example of Array declaration
Variable and Array Initialization
There are two ways variables can be initialized:
1. By statement using the assignment operator (=).
Example of statement initialization
2. During declaration
Example of initialization during declaration
The declaration of arrays is a special case. An entire array can be initialized during declaration by enclosing comma
separated values inside curly brackets "{ }"
Example of Array initialization at declaration
Examples of good variable names:
Temperature LimitSwitch41
PresetCounter
win
errorcode
Examples of bad variable names:
3wayswitch
Run_Lamp
mod
OverCurrentSensingRelayTrippingPoint
Range
0,1
±128
±32767
±4294836225
±4294836225
int
n
short
a, InputBlock1, color
int
g[10]
int
n, V[4]
n
= 399
V[0] = 24
char i='z', a, b=3
int V[4]={24, 15, 5, 0}
183
x
Error
begins with a number
illegal character "_"
reserved word
longer than 32 characters

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Mmi-750Mmi-730Mmi-850

Table of Contents