Basic programming guide – Remote Processing BASIC for the CX-10 Modbus User Manual
Page 23

BASIC PROGRAMMING GUIDE
2-14
DIM
Syntax:
DIM name(size)[,name(size)...]
Where: name = Any valid variable name
size = 1 to 255 elements
Function:
Reserves storage for single-dimension array.
Mode:
Command, run
Use:
DIM FLOW(200) : REM dimensions a 200 element array called FLOW
DESCRIPTION
The maximum number of array elements is 255, accessed as name(0) through name(254). CLEAR, NEW, or
RUN commands de-allocate all array storage. The default size of undeclared arrays is 10 (i.e. 11 elements).
An array cannot be redimensioned after it has been dimensioned. Memory required for an array is ((integer
size + 1) * 6). Array A(99) requires 600 bytes of memory. Available memory typically limits the size and
number of dimensioned arrays.
RELATED
STRING, CLEAR
ERROR
ARRAY SIZE
When size >255
EXAMPLE
10
DIM FLOW(200), LEVEL(200)
20
ONTICK 1,1000
30
IF PTR < 200 THEN 30
40
ONTICK 0,1000
50
FOR N=0 TO 199
60
PRINT FLOW(N),LEVEL(N)
70
NEXT
80
END
1000 FLOW(PTR)=REGERAD(7001)
1010 LEVEL(PTR)=REGREAD(3)
1020 PTR=PTR+1
1030
RETI