Char (8-bit)
1
1
Bool (8-bit)
2
1
Bool (8-bit)
1
1
When a GetData() or SetData() function is executed using a 32-bit data type (Int or Float), the function will
automatically convert the data. For example:
// get a floating point value from a modbus device
// note that two registers will actually be read,
// since a floating point value occupies
2
registers
macro_command
main()
float
f
GetData
(f,
“MODBUS”
,
4
x_BIN,
101
,
1
) // f will contain a floating point
value
end macro_command
// get (
5
)
32
-bit integer values from the HMIs internal storage
// note that 10 registers will actually be read,
// since each integer value occupies
2
words
macro_command
main()
int
Values[
5
]
GetData
(Values[
0
],
“Local HMI”
, LW,
200
,
5
) // each element of
Values[] will contain a
32
-bit integer value
end macro_command
Precautions, Tips & Tricks when Using Macros
• The size of a macro in an xob file is limited by the memory of the OIT.
• The maximum storage space of local variables in a macro is 4K bytes.
• A maximum of 256 macros are allowed in an EasyBuilder project.
• A macro may cause the OIT to lock up. Possible causes are:
• A macro contains an infinite loop with no PLC communication.
• The size of an array exceeds the storage space in a macro.
• PLC communication time may cause the macro to execute slower than expected.
• Random macro compiler errors can often be corrected by recompiling again, or canceling out of
the macro editor and then reopen and compile again.
• Some macros don’t work the way they should due to the declaration of some variables and how
they get interpreted. Some Boolean arrays work better when defined as an array of ‘short’s or
‘int’s. When getting data from an external register, the variable to receive it is best declared as a
‘short’ or an array of ‘short’s.
Com piler Er rors & Er ror Codes
When there are compile errors, the error description can be referenced by the compiler error message number.
Error message format: Macro_name(: Error_message_number ) Error_Message.
• (1): "Syntax error", "identifier" - There are many possibilities for the cause of this compiler error.
Simply stated, the compiler found a problem with the syntax of the statement
• (2): Used without having been initialized. - Must define the size of an array during declaration. The
array size declaration must be a constant whole number, not a variable.
• (3): “Redefinition error: ” - The name of variable and function within its scope must be unique.
Macro_Command main( )
int g[10] , g //<- illegal – redefinition of ‘g’
For g[2] = 0 To 2
g[3] = 4
1010-1007, Rev 05
254
Sil ver Plus Se ries In stal la tion & Op er a tion Man ual
Summary of Contents for Silver Plus Series
Page 20: ...1010 1007 Rev 05 16 Silver Plus Series Installation Operation Manual ...
Page 31: ...COM Ports for the HMI5056 5070 1010 1007 Rev 05 Connect the OIT to the PLC or Controller 27 ...
Page 38: ...1010 1007 Rev 05 34 Silver Plus Series Installation Operation Manual ...
Page 49: ...7 Click the Shape tab 1010 1007 Rev 05 Creating Your First Project 45 ...
Page 62: ...1010 1007 Rev 05 58 Silver Plus Series Installation Operation Manual ...
Page 75: ...3 Click OK The System Parameter Settings dialog appears 1010 1007 Rev 05 Using EZware 5000 71 ...
Page 132: ...1010 1007 Rev 05 128 Silver Plus Series Installation Operation Manual ...
Page 156: ...1010 1007 Rev 05 152 Silver Plus Series Installation Operation Manual ...
Page 210: ...1010 1007 Rev 05 206 Silver Plus Series Installation Operation Manual ...
Page 216: ...1010 1007 Rev 05 212 Silver Plus Series Installation Operation Manual ...
Page 246: ...1010 1007 Rev 05 242 Silver Plus Series Installation Operation Manual ...