ASCII CONSTANTS
The PICC Lite compiler supports a number of ASCII constants which can be used in programs instead of their numeric values. The following are constants the frequently used:
Character constants are used by enclosing them in single quotes. For example, the variable
temp can be assigned the null character by writing:
temp = ’ ’;
ARITHMETIC AND LOGIC OPERATORS
The PICC Lite compiler supports a large number of arithmetic and logical operators. The most commonly used operators are summarized below:
Some of the operators are unique to the C language and need further clarification. The pre- increment and post-increment operators and their equivalents are:
It is important to realize that if the operator occurs after a variable name in an expression, the value of the variable is used in the expression, and then the variable is changed afterwards. Similarly, if the operator occurs before the variable name, the value of the variable is changed before evaluating the expression and then the expression is evaluated:
In C, these logical connectors employ a technique known as lazy evaluation. This means that the expressions evaluate left to right and the right expression is only evaluated if it is required. For example, false && false is always false and if the first expression is false there is no need to evaluate the second one. Similarly, true || true is always true and if the first expression is true the second one is not evaluated.
An example is given here to clarify the use of the operators.
Example 4.1
sum and count and total are two 8-bits-wide unsigned char type variables. If sum = 65 and count = 240, find the values of the following expressions: