78
6250 Servo Controller User Guide
Teach the Data
to the Data
Program
The data that you wish to write to the data elements in the data program must first be placed
into numeric variables (
VAR
). Once the data is stored into numeric variables, the data elements
in the data program can be edited by using the Data Pointer (
DATPTR
) command to move the
data pointer to that element, and then using the Data Teach (
DATTCH
) command to write the
datum from the numeric variable into the element.
When the
DATSIZ
command is issued, the internal data pointer is automatically positioned to
data element #1. Using the default settings for the
DATPTR
command, the numeric variable
data is written to the data elements in sequential order, incrementing one by one. When the last
data element in the data program is written, the data pointer is automatically set to data
element #1 and a warning message (
*WARNING: POINTER HAS WRAPPED AROUND TO
DATA POINT 1
) is displayed. The warning message does not interrupt program execution.
The
DATPTR
command syntax is
DATPTRi,i,i
. The first integer (
i
) represents the data
program number (1 through 9). The second integer represents the number of the data element
to point to (1 through 6500). The third integer represents the number of data elements by
which the pointer will increment after writing each data element from the
DATTCH
command,
or after recalling a data element with the
DAT
command.
The
DATTCH
command syntax is
DATTCHi<,i,i,i>
. Each integer (
i
) represents the
number of a numeric variable. The value of the numeric variable will be stored into the data
element(s) of the currently active data program (i.e., the program last specified with the last
DATSIZ
or
DATPTR
command). As indicated by the number of integers in the syntax, the
maximum number of variable values that can be stored in the data program per
DATTCH
command is 4. Each successive value from the
DATTCH
command is stored to the data
program according to the pattern established by the third integer of the
DATPTR
command.
As an example, suppose data program #1 is configured to hold 13 data elements
(
DATSIZ1,13
), the data pointer is configured to start at data element #1 and increment 1 data
element after every value stored from the
DATTCH
command (
DATPTR1,1,1
), and the
values of numeric variables #1 through #3 are already assigned (
VAR1=2
,
VAR2=4
,
VAR3=8
). If you then enter the
DATTCH1,2,3
command, the values of
VAR1
through
VAR3
will be assigned respectively to the first three data elements in the data program,
leaving the pointer pointing to data element #4. The response to the
TPROG DATP1
command would be as follows (the text is highlighted to illustrate the final location of the
data pointer after the
DATTCH1,2,3
command is executed):
*DATA=2.Ø,4.Ø,8.Ø,Ø.Ø
*DATA=Ø.Ø,Ø.Ø,Ø.Ø,Ø.Ø
*DATA=Ø.Ø,Ø.Ø,Ø.Ø,Ø.Ø
*DATA=Ø.Ø
If you had set the
DATPTR
command to increment 2 data elements after every value from the
DATTCH
command (
DATPTR1,1,2
), the data program would be filled differently and the data
pointer would end up pointing to data element #7:
*DATA=2.Ø,Ø.Ø,4.Ø,Ø.Ø
*DATA=8.Ø,Ø.Ø,Ø.Ø,Ø.Ø
*DATA=Ø.Ø,Ø.Ø,Ø.Ø,Ø.Ø
*DATA=Ø.Ø
Recall the Data
from the Data
Program
After storing (teaching) your variables to the data program, you can use the
DATPTR
command to
point to the data elements and the
DATi
("
i
" = data program number) data assignment command
to read the stored variables to your motion program. You cannot recall more than one data
element at a time; therefore, if you want to recall the data in a one-by-one sequence, the third
integer of the
DATPTR
command must be a
1
(this is the default setting).