UD70
Issue code: 70nu2
7-10 Reference
DELAY
Syntax
DELAY (Integer expression%)
The
DELAY instruction causes the program to pause for a time specified by
the integer expression in increments of 0.1 second. This instruction cannot
be relied on to produce an accurate time delay. In the worst case, the time
delay could be 100ms shorter than that specified (it will never be longer).
DELAY can be used only in INITIAL or BACKGROUND Tasks.
Example
#18.12 = 10 //set parameter 18.12 to 10
DELAY(10) //delay program for 1 second.
#18.12 = 0
DIM
Syntax
DIM variable% [number_of_elements%]
DIM variable [number
_of_elements%]
The
DIM instruction is used to specify an array of a set of variables of the
same type (integers or floating-point). The instruction does not produce
any code, but tells the compiler to reserve space for a dynamic array.
An array must be specified before the array is used. It is recommended that
an array is specified in the
INITIAL Task, but it can be specified in the task the
array is to be used in.
Example
INITIAL{
DIM myarray%[100] //declares an integer called
//[myarray] which has 100 elements.
myarray%[0] = 10 //initialise the first element to 10
myarray%[1] = 20 //initialise the second element to 20
myarray%[99] = 50 //initialise the last element
index% = 1
}
CLOCK{
myarray%[index%] = #3.02 //get speed feedback
index% = index + 1 //increment index counter
IF index% = 100 THEN
index% = 0
ENDIF
}
See also Arrays under Variables in Chapter 4 DPL Programming.