Macro Language Motion
Valid for S300, S700
Motion Tasks in EEPROM or RAM
To handle motion tasks in a PLC program it is possible to use the commands XWRITE and COMMAND that access to ASCII variables:
Motion Task No. 0
Starting a Motion Task
Starting a Jog Move (in OPMODE 8)
Starting a Reference Move
Stop Motion
Change OPMODE
Camming Functions
Up to 8 profiles can be stored in the drive's memory. All profiles together can have up to 8000 points.Table numbers start with 0.
The system variables LTABL0,...LTABL7 represent the lengths of the tables.
If a cam table shall be followed based on an external master like an encoder, the parameter EXTPOS should be set to negative value according to the encoder. The camming can then be based upon the variable PFB0. Camming is done in OPMODE 5 with the position coming from the table being written to the macro NEWPOS.
The following functions can be used:
FUNCTION4(GETTAB,TABVAL,TABNR,INDEX,TABREST);
This function gets a value from a table and also does a (linear) interpolation between two values. All variables must be defined as LONG variables.
Parameter |
Meaning of the parameters
|
---|---|
FUNCTION4
|
Calls a function with 4 variables of type LONG.
|
GETTAB
|
Name of the function
|
TABVAL
|
Result of the function.
|
TABNR
|
Number of the table
|
INDEX
|
Pointer for the table. Value from table position INDEX is taken.
|
TABREST
|
Rest, used for interpolation between table values. Format 0...1023
|
The value of TABVAL is calculated as follows:
TABVAL:=TABLE{TABNR}{INDEX} + ((TABLE{TABNR}{INDEX+1}-TABLE{TABNR}{INDEX})*TABREST)>>10;
FUNCTION5(GEARALL,POSOUT,TABVAL,MYGEARI,MYGEARO,MYREST);
This function eine multiplies and devides and and takes care of the division remainder.
Application: Gearing functions.
All variables must be defined as LONG variables.
Parameter |
Meaning of the parameters
|
---|---|
FUNCTION5
|
Calls a function with 5 variables of type LONG
|
GEARALL
|
Name of the function
|
POSOUT
|
Result of the function
|
TABVAL
|
Input to the function
|
MYGEARI
|
Gearing factor demoninator
|
MYGEARO
|
Gearing factor numerator
|
MYREST
|
Rest, not to be changed by user program
|
The function does the following calculations:
TEMP = TABVAL*MYGEARO+MYREST; POSOUT = TEMP/MYGEARI; MYREST = TEMP%MYGEARI; (% means Modulo operation)
Drifting of the axis because of incremental division faults (remainder) is ommitted, because MYREST is always considered.
Back to top