Mikroelektronika MIKROE-742 데이터 시트

다운로드
페이지 532
Literals
Literals are tokens representing fixed numeric or character values.
The data type of a constant is deduced by the compiler using such clues as numer-
ic value and format used in the source code.
Integer Literals
Integral values can be represented in decimal, hexadecimal, or binary notation.
In decimal notation, numerals are represented as a sequence of digits (without com-
mas, spaces, or dots), with optional prefix + or - operator to indicate the sign. Values
default to positive (6258 is equivalent to +6258).
The dollar-sign prefix (
$
) or the prefix 0x indicates a hexadecimal numeral (for exam-
ple, 
$8F
or 
0x8F
).
The percent-sign prefix (
%
) indicates a binary numeral (for example, 
%01010000
).
Here are some examples:
11    
// decimal literal
$11   
// hex literal, equals decimal 17
0x11  
// hex literal, equals decimal 17
%11   
// binary literal, equals decimal 3
The allowed range of values is imposed by the largest data type in mikroPascal
PRO for AVR – 
longint.
Compiler will report an error if the literal exceeds
2147483647
(
$7FFFFFFF
).
Floating Point Literals
A floating-point value consists of:
- Decimal integer 
- Decimal point 
- Decimal fraction 
- e or E and a signed integer exponent (optional) 
You can omit either the decimal integer or decimal fraction (but not both).
Negative floating constants are taken as positive constants with the unary operator
minus (-) prefixed.
123
MIKROELEKTRONIKA
- SOFTWARE AND HARDWARE SOLUTIONS FOR EMBEDDED WORLD
Language Reference
mikroPASCAL PRO for AVR
CHAPTER 5