Variable Declarations; Variable Initialization - Maple Systems Silver Plus Series Installation And Operation Manual

Hide thumbs Also See for Silver Plus Series:
Table of Contents

Advertisement

246
• bool: 1 bit
• arrays: the corresponding number of bytes for each element, plus another 2 bytes for the index
Macros use memory from the background task (defined as Window 0 ) area. There is a default memory size of
320K available for macros (only 220K is allotted if the 'Fast Selection' task bar is enabled) and the there are other
background task objects that also use memory in this area, such as:
• Trends
• Data Transfers
• Alarms
• Events
• PLC Controls
• Printer functions

Variable Declarations

Each variable that will be used in the macro needs to be declared as a specific 'type' of register. The declarations are
listed as the first part of the macro. Any declarations contained within the macro function is considered 'Local' and
any variable outside the macro function is considered 'Global'. Local variables are only seen within the function
they are declared in. Global variables retain their values and can be globally used by all functions. Below, are listed
the various data types that can be declared:
TypeDescription

Variable Initialization

Initialize a value of variable in the declaration statement directly. (e.g: int RPM = 75) Use the assignment operator
(=) to initialize a value to the variable. Variables can be declared and initialized in the following manor:
Stacked Example: Inline Example (separate like-types with a comma):
1010-1007, Rev 05
If the application exceeds the 320k limit, both the simulator and the OIT will display a
System Severe Error message.
Float
Single-Precision Floating point variable (32-bit signed,
IEEE-754 format)
Int
Integer variable (32-bit signed)
Short
Short integer variable (16-bit signed)
Char
Character variable (8-bit unsigned)
Bool
Boolean variable (1-bit)
Variables inside macros are initialized to all '1's as a default (i.e. 0xFFFF), so don't
assume they are zero values when you enter the macro. It is good programming
practice to initialize variables during declaration, or use assignment statements before
they are used.
short a = 0
short b = 0
short c = 0
short a=0, b=0, c=0
Sil ver Plus Se ries In stal la tion & Op er a tion Man ual

Advertisement

Table of Contents
loading

Table of Contents