User manual
mikroPascal PRO for dsPIC30/33 and PIC24
MikroElektronika
216
Operators
Operators are tokens that trigger some computation when being applied to variables and other objects in an expression.
There are four types of operators in mikroPascal PRO for dsPIC30/33 and PIC24:
- Arithmetic Operators
- Bitwise Operators
- Boolean Operators
- Relational Operators
Operators Precedence and Associativity
There are 4 precedence categories in mikroPascal PRO for dsPIC30/33 and PIC24. Operators in the same category
have equal precedence with each other.
Each category has an associativity rule: left-to-right (→), or right-to-left (←). In the absence of parentheses, these rules
resolve the grouping of expressions with operators of equal precedence.
Precedence Operands Operators Associativity
4 1
@ not + -
←
3 2
* / div mod and shl shr
→
2 2
+ - or xor
→
1 2
= <> < > <= >=
→
Arithmetic Operators
Arithmetic operators are used to perform mathematical computations. They have numerical operands and return
numerical results. Since the char operators are technically bytes, they can be also used as unsigned operands in
arithmetic operations.
All arithmetic operators associate from left to right.
Operator Operation Operands Result
+
addition
byte, short, word, integer,
longint, dword, real
byte, short, word, integer,
longint, dword, real
-
subtraction
byte, short, word, integer,
longint, dword, real
byte, short, word, integer,
longint, dword, real
*
multiplication
byte, short, word, integer,
longint, dword, real
word, integer, longint,
dword, real
/
division, oating-point
byte, short, word, integer,
longint, dword, real
real
div
division, rounds down to
nearest integer
byte, short, word, integer,
longint, dword
byte, short, word, integer,
longint, dword
mod
modulus, returns the remain-
der of integer division (cannot
be used with oating points)
byte, short, word, integer,
longint, dword
byte, short, word, integer,
longint, dword