
MCO 305 Design Guide
__ How to Program __
MG.33.L4.02 – VLT
®
is a registered Danfoss trademark
87
Inform yourself about the type of assignment operation which is structured in accordance with the Bit/Byte
commands and about the priorities of the operators and the operations.
NB!:
All arithmetical operations are integer number operations.
Operators
Symbol
Meaning
Syntax / Example
Description
+
plus
3 + 3
= 6
Addition
–
minus
9 – 3
= 6
Subtraction
*
times
2 * 3
= 6
Multiplication
%
divided by
19 % 3
= 6
Division (result is truncated)
^
XOR
expr1 ^ expr2
127 ^ 255 = 128
Exclusive Or (binary operation)
mod
Modulo
expr1 mod expr2
250 mod 16 = 10
Mathematic modulo (rest of an integer division)
rnd
Division
expr1 rnd expr2
250 rnd 16 = 16
Division with round-off (opposite to truncating)
abs
Absolute
amount
Abs(expr)
abs (-5) = 5
Absolute amount of the expression
Bit Operators
Symbol
Meaning
Syntax / Example
Description
Value range
&
and
7 & 6
= 6
bit-by-bit relationship
_
or
2 | 4
= 6
bit-by-bit relationship
a
invert
a
(–7)
= 6
bit-by-bit inversion
<<
left shift
3 << 1
= 6
bit-by-bit shift to the left
>>
right shift
12 >> 1
= 6
bit-by-bit shift to the right
.
Bit
expr1.expr2
7.1 = 1
7.3 = 1
7.4 = 0
Returns the Bit expr2 from expr1
1 - 32
.b
Byte
expr1.b
expr2
0x027F.b1 = 127
0x027F.b2 = 2
Returns the Byte expr2 from expr1
1 - 4
.w
Word
expr1.w expr2
0x0010FFFF.w2 = 16
Returns the Word expr2 from expr1
1 - 2
.l
Long
expr1.l expr2
Returns the Long expr2 from expr1
(standard)
Summary of Contents for MCO 305
Page 4: ......