Using Floating Point Registers Within Macros; Statements, Conditions & Expressions - Maple Systems Silver Series Installation And Operation Manual

Operator interface terminal
Hide thumbs Also See for Silver Series:
Table of Contents

Advertisement

Macros

Using Floating Point Registers Within Macros

Reading and writing external floating point registers can only be used in a macro as a transfer function. The macro
routine has no functionality to interpret an external floating point formatted (IEEE-754 format) register. Although a
variable can be declared as a 'float' type within the macro, it can not store the external float register properly.
When reading or writing a 32-bit floating point (also call a 'real') register that is external to the macro using
GetData() or SetData(), you must use an array of (2) 16-bit 'shorts'. Internally, the macro can use an 'int' type
variable to store a value up to +/- 2,147,483,647 (a signed 32-bit register). But when using the GetData() or
SetData() functions it only does a 16-bit external transfer even though it may be declared as 'int' (32-bit).
Statements, Conditions & Expressions
An expression combines constants, variables, arrays, functions, and operators under certain rules. Expressions can
be logical or mathematical equations.
Below are listed some of the different styles of statements:
A declaration (definition) statement is constructed like the following:
Format
type name
type name
[constant]
An assignment statement will transfer (assign) an expression to a variable. The form is:
Format
variable = expression
logic or conditional statement processes a logic expression and branches depending on the result. This
assigns the result of the expression to a variable. The ending statement 'End If' is written as two words, not
one word. Note that there is a difference between the conditional equality noted by two equal signs '= ='
(read as: 'is equal to') and the assignment equality noted by only one equal sign '='.
// This routine
puts (2) 16-bit array variables into one 32-bit
variable
Int LVal
short Data[2]
LVal = (Data[1] < 16) + Data[0]
// This routine will not work – a GetData of more than one
element requires
// a variable that is declared as an array
float RealData
// get the floating point register and store it in 'RealData'
GetData(RealData ,F8_Binplc ,1,2)
// This routine reads a 32-bit holding register
short Data[2]// grab a 32-bit register [(2) 16-bit] value from a
PLC register address 4x:1 GetData(Data[0] ,4x_Binplc ,1,2)
Examples
short
MyVar
Short
MyVars[10]
Examples
MyVar = 10
MyVar = x + y
Explanation
This defines the name of the variable
register and its type
This defines an array name and the
[constant] is the number of 'type elements'
in the array
Explanation
This assigns the result of the expression to
a variable
1010-1001a, Rev 02
253

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents