User manual

mikroPascal PRO for dsPIC30/33 and PIC24
MikroElektronika
220
With shift right (shr), right most bits are discarded, and the “freed” bits on the left are assigned zeroes (in case of
unsigned operand) or the value of the sign bit (in case of signed operand). Shifting operand to the right by n positions
is equivalent to dividing it by 2
n
.
Boolean Operators
Although mikroPascal PRO for dsPIC30/33 and PIC24 does not support boolean type, you have Boolean operators
at your disposal for building complex conditional expressions. These operators conform to standard Boolean logic and
return either TRUE (all ones) or FALSE (zero):
Operator Operation
and
logical AND
or
logical OR
xor
logical exclusive OR (XOR)
not
logical negation
Boolean operators associate from left to right. Negation operator not associates from right to left.
Unary Operators
Unary operators are operators that take exactly one argument.
Unary Arithmetic Operator
Operator - can be used as a prex unary operator to change sign of a signed value. Unary prex operator + can be
used also, but it doesn’t affect data.
For example:
b := -a;
Unary Bitwise Operator
The result of the not (bitwise negation) operator is the bitwise complement of the operand. In the binary representation
of the result, every bit has the opposite value of the same bit in the binary representation of the operand.
Operator Operation
not
bitwise complement (unary); inverts each bit
Example:
not 0x1234 ‘ equals 0xEDCB