User`s manual
<< : shift left the operand for a number of bit places specified in the right operand
(must be positive and less then 255).
>> : shift right the operand for a number of bit places specified in the right
operand (must be positive and less then 255).
For example, if you need to extract the higher byte, you can do it like this:
dim temp as word
main:
TRISA = word(temp >> 8)
end.
Destination will hold the correct value if it can properly represent the result of the
expression (that is, if result fits in destination range). More details can be found in
chapters Type Conversions and Assignment and implicit Conversion.
mikroBasic is more flexible compared to standard Basic as it allows both implicit
and explicit type conversion. Note that you cannot mix signed and unsigned data
types in expressions with logical operators.
mikroBASIC
- Basic Compiler for Microchip PIC microcontrollers
80
mikroBASIC
MikroElektronika: Development tools - Books - Compilers
making it simple...
page
Logical (Bitwise) Operators
Overview
<< and >>
Important
Logical
Operators
and Data
Types
Operator Operation Operand Types Result Types
not bitwise negation
byte, word, short,
integer, long
byte, word, short,
integer, long
and bitwise conjunction
byte, word, short,
integer, long
byte, word, short,
integer, long
or bitwise disjunction
byte, word, short,
integer, long
byte, word, short,
integer, long
xor bitwise xor
byte, word, short,
integer, long
byte, word, short,
integer, long
<< bit shift left
byte, word, short,
integer, long
byte, word, short,
integer, long
>> bit shift right
byte, word, short,
integer, long
byte, word, short,
integer, long