5 downloading and uploading a program, 5 downloading and uploading a program -20 – ElmoMC SimplIQ Software Manual User Manual

Page 82

Advertising
background image

SimplIQ

Software Manual

Program Development and Execution

MAN-SIMSW (Ver. 1.4)

6-20

6.4.2

Evaluating Expressions Used in Compiler Directives

The #define, #if and #elseif directives may contain constant expressions for evaluation.
Such expressions – which may be either simple (a single number) or complex (a combination
of operations) – must be evaluated to a single number.

A valid expression can operate only with:
ƒ

Numbers

ƒ

Values of the #define directive.

If the expression contains the identifier of the #define directive, the identifier must have a
successfully-evaluated token_string.

The syntax of the expression of a pre-compilation directive differs from the syntax of

other expressions in that it has the following limitations:
ƒ

It cannot contain global or local variables; only constant values are valid.

ƒ

It cannot use any system or user functions, or system commands.

ƒ

Only integer and float data types are allowed. Arrays and array members are
illegal.

An expression in a pre-compilation directive uses the same operators as other expressions in
the user program. The valid operators are:
ƒ

Calculating operators:

*

/

=

-

%

ƒ

Logical operators:

&& ║

ƒ

Comparison operators: ==

!=

<

>

<=

>=

ƒ

Bitwise operators:

&

|

<<

>>

ƒ

Unary logical operators: !

ƒ

Unary bitwise operators: ~

A detailed description of the operators is given in

section

4.2.2

. The data type of the

evaluation result depends on the operation and the type of operands. The result of logical,
bitwise and comparison operations is always integer. With calculating operations, if both
operands are integers, the result is integer; otherwise, the type is float.

6.5

Downloading and Uploading a Program

In this step of program development, communication between the Composer and the

SimplIQ

drive must be established.

After successfully compilation, the compiled code can be downloaded to the

SimplIQ

drive.

This step is supported by the Composer IDE. Before each download, the Composer
automatically clears the flash memory sector, which is used for saving the user program.

The serial flash performs downloads and uploads using two commands: DL and LS. Both
commands use the auxiliary LP command, which is a vector integer command. The CP
command can be used to clear the user flash area, and the CC command can be used to
checksum-verify the program, and set the program read flag.

Advertising