User guide

95
VTB USER GUIDE
4) Declare the following GLOBAL VARIABLES:
PosAxes(2) long - position of the axis
Rapp(2) Float - ratio between generated steps and effective movement
5) Initialize in the section INIT of the MAIN task the variable RAPP(0) and RAPP(1) at the desired value
(however not equal to 0). A negative value will be able to change the direction of the axis.
7) Set the following PROPERTY of the OBJECT INTERPOLA1 (example)
7) Write in TASK PLC the following CODE:
pp_step(0, Obj.pc(0) * Rapp(0)) ' Asse X
pp_step(1, Obj.pc(1) * Rapp(1)) ' Axxe Y
8) Write in MAIN TASK the test code to execute a movement (example):
function MoveAxes(Qx as Long, Qy as Long, Vel as Long)
PosAxes (0)=Qx
PosAxes (1)=Qy
Obj.moveto(Vel, 1, PosAxes ())
endfunction
9) Call the declared function with desired parameters.
NOTES FOR A CORRECT PRESET OF STEP/DIR CHANNELS
Be careful when working with STEP/DIR or CAN OPEN axis in interpolation mode. In the chapter on interpolation functions
it is already described an eample to manage the preset with CAN OPEN axis. Below will be treated the problem connected
to the STEP/DIR axis.
The function PP_STEP works asynchronously to the function generating the trajectories as MONOAX or INTERPOLATOR.
It is necessary that the positions of these objects are in agreement with the internal position of the steps generator. The
number of generated steps by the function PP_STEP will correspond to the value difference of the position variable
between two sample (TASK PLC). Resetting immediately the value of this variable, the function PP_STEP will generate a
number of steps equal to the old value of the variable, and all in a single sample.
For example assuming the variable has a value of 10000, in the instant it is zeroed will be generate 10000 STEPS in a
sample. Considering a sample of 2 mSec we have a frequency of 5MHz !
To avoid that happen it needs at each PRESET of the axis (changing of the support variable) to stop the generator of
STEPS and re-enable it when the position will agree.
Then it is always better put under condition the calling of step generating function PP_STEP in the following mode:
if DisableStep=false
pp_step(0, Obj.pc(0) * Rapp(0)) ' AXES X
pp_step(1, Obj.pc(1) * Rapp(1)) ' AXES Y
endif