Character variable (8-bit unsigned)
Bool
Boolean variable (1-bit)
Variables inside macros are initialized to all ‘1’s as a default (i.e. 0xFFFF), so don’t
assume they are zero values when you enter the macro. It is good programming
practice to initialize variables during declaration, or use assignment statements before
they are used.
Variable Initialization
Initialize a value of variable in the declaration statement directly. (e.g: int RPM = 75) Use the assignment operator
(=) to initialize a value to the variable. Variables can be declared and initialized in the following manor:
Stacked Example: Inline Example (separate like-types with a comma):
short a = 0
short b = 0
short c = 0
short a=0, b=0, c=0
Variables contain an unknown, random value when declared. Variables must be
initialized before they are used.
Array Initialization
For mats:
int MyArray[10] = {1,2,3,4,5,6,7,8,9,10}
char LetterArray[6] = ‘MYWORD’
The initial values are written within the brackets {} and are divided by comma (,). These values are assigned in
order from left to right starting from array index=0.
Con stants:
A constant is a numeric or boolean value that does not change. Constants may be written as any of the following:
Written As Examples
Decimal constant 1234 short MyVal = 1234
Hexadecimal constant 0xFA20 short MyVal = 0xFA20
ASCII code (character constant) ‘ABCD’ char String[4] = ‘ABCD’
Boolean: True (not zero), False (zero) True, 1, False, 0 bool Done = 0, or, bool Done = False
Reserved Words
The following symbols and names are keywords that are reserved for use by macros. They cannot be used (as a
complete name) in any function name, array name, or variable name. However, the reserved words may be
contained within a variable name such as: my_int, TheEnd, etc.
And down int Step
bool Else next Then
Break End not To
Binaux False Or True
Binplc float return void
Case For select wend
char GetData SetData While
Continue If short xor
1010-1001a, Rev 02
Macros 249