B&B Electronics VFG3000 - Manual User Manual
Page 196

I
NDEXING
A
RRAYS
V
LINX
F
IELDBUS
G
ATEWAY
M
ANAGER
U
SER
M
ANUAL
P
AGE
180
Each example shifts
Data
two bits in the specified direction.
B
ITWISE
NOT
Finally, Fieldbus Gateway Manager provides a bitwise NOT operator to invert the sense of
the bits in a value…
O
PERATOR
P
RIORITY
E
XAMPLE
Bitwise NOT
Group 2
~Mask
This example produces a value where every bit is equal to the opposite of its value in
Mask
.
I
NDEXING
A
RRAYS
Elements within an array tag can be selected by following the array name with square
brackets that contain an indexing expression. This expression must range from 0 to one less
than the number of elements in the array. If you create a 10-element array, for example, the
first element will be
Name[0]
and the last will be
Name[9]
.
I
NDEXING
S
TRINGS
Square brackets can also be used to select characters within a string. For example, if you have
a tag called Text that contains the string “ABCD”, then the expression
Text[0]
will return a
value of 65, this being equal to the ASCII value of the first character. Index values beyond the
end of the string will always return zero.
A
DDING
S
TRINGS
As well as adding numbers, the addition operator can be used to concatenate strings. Thus, the
expression
"AB"+"CD"
evaluates to "ABCD”. You may also use the addition operator to add
an integer to a string, in which case a single character equal to the ASCII code represented by
the integer is appended to the data in the string.
C
ALLING
P
ROGRAMS
Programs that return values may be invoked within expressions by following the program
name with a pair of parentheses. For example,
Program1()*10
will invoke the associated
program, and multiply the return value by 10. Obviously, the return type for
Program1
must
be set to integer or floating-point for this to make sense.
U
SING
F
UNCTIONS
Fieldbus Gateway Manager provides a number of predefined functions that can be used to
access system information, or to perform common math operations. These functions are
defined in detail in the Function Reference. They are invoked using a syntax similar to that
for programs, with any arguments to the function being enclosed within the parentheses. For
example,
cos(0)
will invoke the cosine function with an argument of 0, returning a value of
+1.0.