Creating Variable Arrays; Using Macros Within Recipes - Maple Systems Silver Plus Series Installation And Operation Manual

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

Advertisement

Mac ros
Global variables exist throughout the entire macro, and are available for any function in the macro. NOTE: If a
local variable has the same name as a global variable, the compiler will use the local variable in the function instead.

Creating Variable Arrays

Arrays are fixed-depth and 1-dimensional only. Arrays can contain up to 65,535 elements. The type is the
declaration of the array of elements, such as an array of ints, or shorts, or bools, etc. The array_size is the number of
elements to contain in the array, such as an array of [10] would contain 10 elements of the declared type. The first
register in an array always begins with the 0
1.
The format is: [type] Array_Name[Array_Size]
For example:
The above declaration defines an array of 100 type 'char' registers named 'table'. The first element in table is
address 0 and the last is 99, so it would be used as:

Using Macros Within Recipes

The macro utility can easily use the recipe memory area. There are 65535 recipe word registers that are available to
the user for general use (addresses RW:0 to RW:65535).
Register types: RW, RWI, and the pointer LW:9000 can be used to read or write the recipe memory area. 'RW'
registers are used to directly address a recipe register. 'RWI' registers are used to indirectly address a recipe register
by using the pointer in local word memory LW:9000. If indirect addressing is used, then the direct recipe address is
determined by adding the value contained in LW:9000 to the address of the RWI register. For instance, to indirectly
point to the direct recipe address RW:20, an example would be that the macro would store the value 15 into the
LW:9000 pointer and then use an RWI address 5 (RWI:5) to GetData() or SetData() {LW:9000 = 15 + RWI:5
RW:20}.
The macro code on the next page will clear all general-use recipe memory area. Because of the pointer's limitation
(max of LW:9000 = 32767), it breaks up the incrementing of memory into two sections, the lower half (0 to 29999)
and upper half (30000 to 59999).
macro_command
Global variables are global only within the macro file in which they exist. It is not
possible to share variables between different macro files. To share data between macro
files, read/write the data to share into the HMI's Local Word (LW) and/or Local Bit
(LB) addresses using the macro's GetData() and SetData()UM_PLC functions.
th
element and the last register is the declared number of elements minus
char table[100]
char FirstElement
char Last Element
FirstElement=table[0]
LastElement=table[99]
The pointer has a maximum limitation of 32767, so LW:9000 can indirectly address
from an offset of 0 to 32767. To indirectly address recipe registers above 32767, you
will need to have the RWI address set to a higher address.
main()
int
Address =
0
int
Initial =
0
short
Done =
0
short
Section =
1
// LW2 is used as an indicator
249
1010-1007, Rev 05

Advertisement

Table of Contents
loading

Table of Contents