Mikroelektronika MIKROE-742 데이터 시트

다운로드
페이지 532
VARIABLES
Variable is object whose value can be changed during the runtime. Every variable is
declared under unique name which must be a valid identifier. This name is used for
accessing the memory location occupied by a variable.
Variables are declared in the declaration part of the file or routine — each variable needs
to be declared before being used. Global variables (those that do not belong to any
enclosing block) are declared below the 
uses
statement, above the keyword 
begin.
Specifying a data type for each variable is mandatory. Syntax for variable declaration is:
var identifier_list : type;
identifier_list
is a comma-delimited list of valid identifiers and 
type
can be any
data type.
For more details refer to Types and Types Conversions. For more information on
variables’ scope refer to the chapter Scope and Visibility.
Pascal allows shortened syntax with only one keyword 
var
followed by multiple vari-
able declarations. For example:
var i, j, k : byte;
counter, temp : word;
samples : 
array[100] of word;
Variables and AVR
Every declared variable consumes part of RAM. Data type of variable determines
not only allowed range of values, but also the space variable occupies in RAM. Bear
in mind that operations using different types of variables take different time to be
completed. mikroPascal PRO for AVR recycles local variable memory space – local
variables declared in different functions and procedures share the same memory
space, if possible.
There is no need to declare SFRs explicitly, as mikroPascal PRO for AVR automatically
declares relevant registers as global variables of 
volatile word
see SFR for details.
136
MIKROELEKTRONIKA
- SOFTWARE AND HARDWARE SOLUTIONS FOR EMBEDDED WORLD
Language Reference
mikroPASCAL PRO for AVR
CHAPTER 5