Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Continuous axis jogging
#1
Below is a simple program that jogs the X-axis in "continuous" mode:


close

// Continuous axis jogging PLC example
ptr XJogPlusButton->u.io:$A00000.12.1;
ptr XJogMinusButton->u.io:$A00000.13.1;
csglobal XJogDecelDist;
XJogDecelDist=1.0;

/****************************************/

open plc 28
Ldata.Coord=1; // Work with C.S.1
if (XJogPlusButton) {
pmatch; // Use present, not end position, as ref
rapid inc X(XJogDecelDist); // Command next distance from present
}

if (XJogMinusButton) {
pmatch; // Use present, not end position, as ref
rapid inc X(-XJogDecelDist); // Command next distance from present
}
close

/****************************************/

Some notes:

1. With the "pmatch" command, you don't need to worry about queuing up too many commands. Each scan, it will issue a move incremental to the present instantaneous position.

2. Setting the incremental distance for the command properly will optimize the action. Set it too low, and it will limit the speed below that commanded. Set it too high, and it will keep going too long after the button is released. The ideal distance is the deceleration distance from the desired speed, which is why I called it "XJogDecelDist". For constant (no S-curve) accel, this distance is V^2/(2*A).

3. If the axis corresponds directly to a single motor, this calculation is easy. V is Motor[].JogSpeed and A = -1/Motor[].JogTa (with Motor[].JogTs=0). Motor[].JogTa should be set less than 0 to specify an accel rate.

4. When the axis corresponds to a combination of axes, setting the parameters is a little more tricky. You will probably want to feel around for the best values.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)