Danfoss MCO 305 Design Manual page 170

Programmable motion controller
Hide thumbs Also See for MCO 305:
Table of Contents

Advertisement

MCO 305 Design Guide
Double precision Operators
All operators (+,-,*,%,++,--) are available as double operators starting with MCO 5.00.
NB!:
Up to these compiler and firmware versions all arithmetical operations had been integer number
operations.
Bit Operators
Symbol
Meaning
&
and
|
or
invert
<<
left shift
>>
right shift
.
Bit
.i
Bit
.b
Byte
.ub
.sb
.w
Word
.uw
.sw
.l
Long
New Bit Operators
The bit operators .b and .w always delivered unsigned results. With the following bit operators.
.ub, .uw, .sb, .sw
unsigned or signed results can be explicitly choose, if desired.
Examples:
value = 0x1FFFE
b = value.ub1 // b is 254
b = value.sb1 // b is -2
NB!:
The new Bit operators are supported starting with MCO 5.00.
170
__ How to Program __
Syntax / Example
7 & 6
= 6
2 | 4
= 6
∼(–7)
= 6
3 << 1
= 6
12 >> 1
= 6
expr1.expr2
7.1 = 1
7.3 = 1
7.4 = 0
expr1.i expr2
7.i1 = 1
expr1.b expr2
0x027F.b1 = 127
0x027F.b2 = 2
value = 0x1FFFE
b = value.ub1
// b is 254
value = 0x1FFFE
b = value.sb1
// b is -2
expr1.w expr2
0x0010FFFF.w2 = 16
expr1.l expr2
®
MG.33.L5.02 – VLT
is a registered Danfoss trademark
Description
bit-by-bit relationship
bit-by-bit relationship
bit-by-bit inversion
bit-by-bit shift to the left
bit-by-bit shift to the right
Returns the Bit expr2 from expr1
same as above, but syntax at full
length
Returns the Byte expr2 from expr1
Returns "Byte" unsigned
Returns "Byte" signed
Returns the Word expr2 from expr1
Returns "Word" designed
Returns "Word" signed
Returns the Long expr2 from expr1
(standard)
Value range
1 - 32
1 ... 32
1 - 4
1 - 2

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents