i included a unique CH2 servo tune into each mode and also an enable in the A axis mode
"turning"
Code: Select all
#include "KMotionDef.h"
void main()
{
// A axis / spindle
ch2->InputMode=ENCODER_MODE;
ch2->OutputMode=NO_OUTPUT_MODE;
ch2->Vel= 300000;
ch2->Accel=100000;
ch2->Jerk= 2000000;
ch2->P=10;
ch2->I=0;
ch2->D=20;
ch2->FFAccel=0;
ch2->FFVel=0;
ch2->MaxI=200;
ch2->MaxErr=1e+006;
ch2->MaxOutput=2000;
ch2->DeadBandGain=1;
ch2->DeadBandRange=0;
ch2->InputChan0=2;
ch2->InputChan1=2;
ch2->OutputChan0=5;
ch2->OutputChan1=4;
ch2->MasterAxis=-1;
ch2->LimitSwitchOptions=0x0;
ch2->SoftLimitPos=1e+030;
ch2->SoftLimitNeg=-1e+030;
ch2->InputGain0=-1;
ch2->InputGain1=1;
ch2->InputOffset0=0;
ch2->InputOffset1=0;
ch2->OutputGain=1;
ch2->OutputOffset=0;
ch2->SlaveGain=1;
ch2->BacklashMode=BACKLASH_OFF;
ch2->BacklashAmount=0;
ch2->BacklashRate=0;
ch2->invDistPerCycle=0.0003662109375;
ch2->Lead=0;
ch2->MaxFollowingError=1000000;
ch2->StepperAmplitude=20;
ch2->iir[0].B0=1;
ch2->iir[0].B1=0;
ch2->iir[0].B2=0;
ch2->iir[0].A1=0;
ch2->iir[0].A2=0;
ch2->iir[1].B0=1;
ch2->iir[1].B1=0;
ch2->iir[1].B2=0;
ch2->iir[1].A1=0;
ch2->iir[1].A2=0;
ch2->iir[2].B0=1;
ch2->iir[2].B1=0;
ch2->iir[2].B2=0;
ch2->iir[2].A1=0;
ch2->iir[2].A2=0;
DefineCoordSystem(1,-1,0,-1); // define the coordinate system
}
"indexing"
Code: Select all
#include "KMotionDef.h"
void main()
{
// A axis / spindle
ch2->InputMode=ENCODER_MODE;
ch2->OutputMode=NO_OUTPUT_MODE;
ch2->Vel= 3000;
ch2->Accel=300000;
ch2->Jerk= 3000000;
ch2->P=20;
ch2->I=0;
ch2->D=40;
ch2->FFAccel=0;
ch2->FFVel=0;
ch2->MaxI=200;
ch2->MaxErr=1e+006;
ch2->MaxOutput=2000;
ch2->DeadBandGain=1;
ch2->DeadBandRange=0;
ch2->InputChan0=2;
ch2->InputChan1=2;
ch2->OutputChan0=5;
ch2->OutputChan1=4;
ch2->MasterAxis=-1;
ch2->LimitSwitchOptions=0x0;
ch2->SoftLimitPos=1e+030;
ch2->SoftLimitNeg=-1e+030;
ch2->InputGain0=-1;
ch2->InputGain1=1;
ch2->InputOffset0=0;
ch2->InputOffset1=0;
ch2->OutputGain=1;
ch2->OutputOffset=0;
ch2->SlaveGain=1;
ch2->BacklashMode=BACKLASH_OFF;
ch2->BacklashAmount=0;
ch2->BacklashRate=0;
ch2->invDistPerCycle=0.0003662109375;
ch2->Lead=0;
ch2->MaxFollowingError=1000000;
ch2->StepperAmplitude=20;
ch2->iir[0].B0=1;
ch2->iir[0].B1=0;
ch2->iir[0].B2=0;
ch2->iir[0].A1=0;
ch2->iir[0].A2=0;
ch2->iir[1].B0=1;
ch2->iir[1].B1=0;
ch2->iir[1].B2=0;
ch2->iir[1].A1=0;
ch2->iir[1].A2=0;
ch2->iir[2].B0=1;
ch2->iir[2].B1=0;
ch2->iir[2].B2=0;
ch2->iir[2].A1=0;
ch2->iir[2].A2=0;
EnableAxis(2);
DefineCoordSystem(1,-1,0,2); // define the coordinate system
}