Elmo HARmonica User variables, Built-in Function Calls, Time functions, Example ca1 =

Models: HARmonica HARSFEN0602

1 220
Download 220 pages 51.63 Kb
Page 28
Image 28

HARSFEN0602ElmoHARmonicaSoftwareManual

PRELIMINARYDRAFT

sp=sp*2/5+ac

 

op=ip5

 

If the variable or the command is

vector, the assignment is allowable only for its single member. The

syntax of the vector member assignment is:

<Parameter or command name>[index]=<simple expression>

The index is an index the relevant member vector. Indices are enumerated from zero.

Example: ca[1] = 1

26

4.2.6.3User variables

User variables are defined within a user program. The description and syntax rules of the variable definition see at User variables of User Programming Language

User program variables may be used within the command line only if a program was compiled successfully and downloaded to the Amplifier.

Through the Interpreter a user may inquire user variable value or change it.

A user has to pay special attention to the scope of a variable. A variable may be defined at the global or local scope. The local variables are available only within the function where they are defined, while the global variables are available within any function and outside a function.

A user variable may be inquired or changed when the program is in the running or halt status.

For example, suppose that a compiled program includes the following lines at the global scope: int ZEBRA,GIRAFA[3];

float GNU;

Then the expression GNU=ZEBRA*GIRAFA[1]+2*sin(GIRAFA[2]); is valid. User program variables are case sensitive.

4.2.6.4Built-in Function Calls

The built-in function call may be used in a single expression. For a list of built-in-functions refer Mathematical Functions

The built-in function call may be a part of a single expression.

Example:

sin(3.14/2)

AC=abs(DC)

SP=SP+sin(3.14/2)

4.2.6.5Time functions

Use the TM command to read the system 32 bit microsecond counter.

The time difference from the present time to an older sampling of TM can be taken in two methods:

Example

QP[1] = TM ; ** QP[1] is used just as storage …. ** Do something

QP[2] = QP[1]-TM ; ** QP[2] is time difference in microseconds.

Example

QP[1] = TM ; ** QP[1] is used just as storage …. ** Do something

QP[2] = tdif( QP[1]) ; ** QP[2] is time difference in milliseconds.

Time differences cannot be taken longer then 31 minutes.

Page 28
Image 28
Elmo HARmonica, HARSFEN0602 software manual User variables, Built-in Function Calls, Time functions, Example ca1 =