
The following are the data types, sizes and range
Data Type
Size (bits)
Range
char
8
–128~127
unsigned char
8
0~255
int
8
–128~127
unsigned
8
0~255
short int
8
–128~127
unsigned short int
8
0~255
long
16
–32768~32767
unsigned long
16
0~65535
Declaration
Variables must be declared before being used as this defines the data type
and the size of the variable. The syntax of variable declaration is:
data_type variable_name [,variable_name...];
where data_type is a valid data type and variable_name is the name of
the variable. The variables declared in a function are private (or local) to
that function and other functions cannot access these variables directly.
The local variables in a function exist and are valid only when this function
is called, and are non-valid when exiting from the function. If the variable
is declared outside of all functions, then it is global to all functions.
The qualifier const can be applied to a declaration of any variable, to
specify that the value of the variable will not be changed. The variables
declared with const are placed within the ROM space. The const qualifier
can be used in array variables. A const variable must be initialized upon
declaration, followed by an equal sign and an expression. Other variables
cannot be initialized when declared.
A variable can be declared in a specified RAM address by using the ’@’
character; the syntax is:
data_type variable_name @ memory_location;
For example:
int lcd @ 0
×
20; /* declare the variable lcd in the offset
0
×
20 of RAM */
Also, an array can be declared in a specified location:
int port[8] @ 0
×
20; /* array port takes memory location
0
×
20 through 0
×
27 */
HT-IDE User’s Guide
88
Summary of Contents for HT-IDE
Page 11: ...P a r t I Integrated Development Environment Part I Integrated Development Environment 1 ...
Page 12: ...HT IDE User s Guide 2 ...
Page 20: ...Fig 1 6 Fig 1 7 HT IDE User s Guide 10 ...
Page 24: ...HT IDE User s Guide 14 ...
Page 70: ...HT IDE User s Guide 60 ...
Page 76: ...HT IDE User s Guide 66 ...
Page 92: ...HT IDE User s Guide 82 ...
Page 93: ...P a r t I I Development Language and Tools Part II Development Language and Tools 83 ...
Page 94: ...HT IDE User s Guide 84 ...
Page 148: ...HT IDE User s Guide 138 ...
Page 150: ...Fig 12 1 Fig 12 2 HT IDE User s Guide 140 ...
Page 154: ...HT IDE User s Guide 144 ...
Page 192: ...HT IDE User s Guide 182 ...
Page 194: ...HT IDE User s Guide 184 ...
Page 218: ...HT IDE User s Guide 208 ...
Page 235: ...P a r t V Appendix Part V Appendix 225 ...
Page 236: ...HT IDE User s Guide 226 ...
Page 250: ...HT IDE User s Guide 240 ...