User`s guide

54 Operation Theorem
4.6 Change Speed on the Fly
You can change the velocity profile of command pulse ouput during
operation by v_change() function. This function changes the maximum
velocity setting during operation. However, if you operate under “Preset
Mode” (like start_a_m ove(),…), you are not allowed to change the
acceleration parameter during operation because the deceleration point is
pre-determined. But changing the acceleration parameter when operating
under “Constant Velocity Mode” is valid. Changing speed pattern on the fly
is valid no matter what you choose “Trapezoidal Velocity Profile” or “S-curve
Velocity Profile”. Here we use an example of Trapezoidal velocity profile to
illustarte this function.
Example: There are 3 speed change sensor during an absolute move for
200000 pulses. Initial maximum speed is 10000pps. Change to 25000pps if
Sensor 1 is touched. Change to 50000pps if Sensor 2 is touched. Change
to 100000pps if Sensor 3 is touched. Then the code for this application and
the resulting velocity profiles are shown below.
#include “pci_8134.h”
start_a_move(axis, 200000.0, 1000, 10000, 0.02);
while(!motion_done(axis))
{
// Get Sensor’s information from other I/O card
if((Sensor1==High) && (Sensor2==Low) && (Sensor3 == Low))
v_change(axis, 25000, 0.02);
else if((Sensor1==Low) && (Sensor2==High) && (Sensor3 == Low))
v_change(axis, 50000, 0.02);
else if((Sensor1==Low) && (Sensor2==Low) && (Sensor3 == High))
v_change(axis, 100000, 0.02);
}
Motor
Sensor 2 Sensor 3
Pos=0
Pos=200000
Moving part
Sensor 1