beautypg.com

5 time functions, 6 user function calls, 7 comments – ElmoMC SimplIQ Software Manual User Manual

Page 29: Comments -11

background image

SimplIQ

Software Manual

The Interpreter Language

MAN-SIMSW (Ver. 1.4)

4-11

4.2.6.5 Time Functions

The TM command is used to read the system 32-bit microsecond counter. The time
difference from the present time to an older sampling of TM can be determined using
two methods, as in the following examples:
ƒ QP[1] = TM ; ** QP[1] is used just as storage

….** Do something

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

ƒ 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 can be no longer than 31 minutes. To pause for a given time in a user
program, use the Wait function (

section

5.7.5

).

In a CAN network, the time counter can be changed by the CAN network master,
in which case, the tdif(x) function may return a value different than the time
elapsed since X=TM was sampled.

To prevent an external event from affecting the timer, use the tick function. The time
difference between the present time and an older tick sampling can be determined by one
of two methods, as shown in the following examples:
ƒ

Example 1:
QP[1] = tick(0) ; ** QP[1] is used as storage only

. . . **Do something

QP[2] = QP[1]-tick(0); **QP[2] is the time difference in microseconds

ƒ

Example 2:
QP[1] = tick(1000) ; ** QP[1] is used as storage only

. . . **Do something

QP[2] = tock(QP[1]); **QP[2] is the time difference in milliseconds

The tick( ) and tock ( ) functions cannot measure time differences greater than

32 milliseconds.

4.2.6.6 User Function Calls

The XQ command enables a user function call (see

Chapter 6:

). A user function cannot be

called from the command line without the XQ command.

4.2.7

Comments

Comments are texts written into the code to enhance its readability. A comment starts
with a double asterisk (**) and terminates at the next end of line. The drive ignores
comments when evaluating an expression. The Interpreter handles comments from the
user program only.