Table of Contents

Advertisement

OPERAND
_BGm
_BN
_DA
_DL
_DM
_HMm
_LFm
_LRm
_UL
TIME
Some operands have corresponding commands while others like _LFm, _LRm, and
listed in the Command Reference.

Arrays

For storing and collecting numerical data, the DMC-21x5 provides array space for 24000 elements. The arrays are
one dimensional and up to 30 different arrays may be defined. Each array element has a numeric range of 4 bytes
of integer (2
31
) followed by two bytes of fraction (±2,147,483,647.9999).
Arrays can be used to capture real-time data, such as position, torque and analog input values. In the contouring
mode, arrays are convenient for holding the points of a position trajectory in a record and playback application.
Defining Arrays
An array is defined with the command DM. The user must specify a name and the number of entries to be held in
the array. An array name can contain up to eight characters, starting with an alphabetic character. The number of
entries in the defined array is enclosed in [ ].
DM
posA[7];
DM
speed[100];
DA
posA[];
Assignment of Array Entries
Like variables, each array element can be assigned a value. Assigned values can be numbers or returned values
from instructions, functions and keywords.
Array elements are addressed starting at count 0.
Values are assigned to array entries using the equal sign. Assignments are made one element at a time by
specifying the element number with the associated array name.
NOTE: Arrays must be defined using the command, DM, before assigning entry values.
DM
speed[10];
speed[0]=7650.2;
speed[0]=?;
posA[9]=_TPA;
con[1]=@COS[pos]*2;
timer[0]=TIME;
Chapter 7 Application Programming ▫ 101
DESCRIPTION
Contains the status of motion on the 'm' axis
Contains the serial number of the controller
Contains the number of available array names
Contains the number of available labels
Contains the number of available array elements
Contains the status of the Home Switch for the 'm' axis
Contains the status of the Forward Limit Switch for the 'm' axis
Contains the status of the Reverse Limit Switch for the 'm' axis
Contains the number of available variables
Free-Running Real Time Clock, off by 2.4%, resets with power-on
'defines an array named posA with 7 elements
'defines an array named speed with 100 elements
'deallocates the posA array
'dimension speed Array
'set 1st element of the array to 7650.2
'return array element value
'set 10th element of the array 'posA' to the current
A axis motor position
'set 2nd element of the array 'con' using the 'pos'
variable
'set
1st element of the array 'timer' to the
current TIME value
TIME
do not. All operands are
DMC-21x5 User Manual 1.0a1

Advertisement

Table of Contents
loading

Table of Contents