Code: Select all
#include "KMotionDef.h"
void main()
{
// CH2 A axis
ch2->InputMode=ENCODER_MODE;
ch2->OutputMode=NO_OUTPUT_MODE;
ch2->Vel= 100000;
ch2->Accel=500000;
ch2->Jerk= 5000000;
ch2->P=25;
ch2->I=0.001;
ch2->D=5;
ch2->FFAccel=0;
ch2->FFVel=0;
ch2->MaxI=200;
ch2->MaxErr=1e+006;
ch2->MaxOutput=2048;
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
}
i have no special C program written for M30. might need a "for (;;)" in the code?
here is my code i was running
Code: Select all
N1 G20 G18 G80 G40 G49
G00Z0.1X0.2 (START)
X-0.005 (DOC)
Z-1.75 (CUT)
X0.2 (CLEAR)
Z0.1X0.2 (RESTART)
Z0.1X0.2 (START)
X-0.010 (DOC)
Z-1.745 (CUT)
X0.2 (CLEAR)
Z0.1X0.2 (RESTART)
Z0.1X0.2 (START)
X-0.015 (DOC)
Z-1.74 (CUT)
X0.2 (CLEAR)
Z0.1X0.2 (RESTART)
Z0.1X0.2 (START)
X-0.020 (DOC)
Z-1.735 (CUT)
X0.2 (CLEAR)
Z0.1X0.2 (RESTART)
Z0.1X0.2 (START)
X-0.025 (DOC)
Z-1.730 (CUT)
X0.2 (CLEAR)
Z0.1X0.2 (RESTART)
Z0.1X0.2 (START)
X-0.030 (DOC)
Z-1.725 (CUT)
X0.2 (CLEAR)
Z0.1X0.2 (RESTART)
Z0.1X0.2 (START)
X-0.0325 (DOC)
Z-1.720 (CUT)
X0.2 (CLEAR)
Z0.1X0.2 (RESTART)
Z0.1X0.2 (START)
X-0.035 (DOC)
Z-1.715 (CUT)
X0.2 (CLEAR)
Z0.1X0.2 (RESTART)
Z0.1X0.2 (START)
X-0.0375 (DOC)
Z-1.710 (CUT)
X0.2 (CLEAR)
Z0.1X0.2 (RESTART)
Z0.1X0.2 (START)
X-0.040 (DOC)
Z-1.705 (CUT)
X0.2 (CLEAR)
Z0.1X0.2 (RESTART)
Z0.1X0.2 (START)
X-0.0425 (DOC)
Z-1.700 (CUT)
X0.2 (CLEAR)
Z0.1X0.2 (RESTART)
Z0.1X0.2 (START)
X-0.045 (DOC)
Z-1.695 (CUT)
X0.2 (CLEAR)
Z0.1X0.2 (RESTART)
Z0.1X0.2 (START)
X-0.0475 (DOC)
Z-1.690 (CUT)
X0.2 (CLEAR)
Z0.1X0.2 (RESTART)
Z0.1X0.2 (START)
X-0.050 (DOC)
Z-1.685 (CUT)
X0.2 (CLEAR)
Z0.1X0.2 (RESTART)
Z0.1X0.2 (START)
X-0.0525 (DOC)
Z-1.680 (CUT)
X0.2 (CLEAR)
Z0.1X0.2 (RESTART)
Z0.1X0.2 (START)
X-0.055 (DOC)
Z-1.675 (CUT)
X0.2 (CLEAR)
Z0.1X0.2 (RESTART)
Z0.1X0.2 (START)
X-0.0575 (DOC)
Z-1.67 (CUT)
X0.2 (CLEAR)
Z0.1X0.2 (RESTART)
A10.909
G04P1
Z0.1X0.2 (START)
X-0.005 (DOC)
Z-1.75 (CUT)
X0.2 (CLEAR)
Z0.1X0.2 (RESTART)
Z0.1X0.2 (START)
X-0.010 (DOC)
Z-1.745 (CUT)
X0.2 (CLEAR)
Z0.1X0.2 (RESTART)
Z0.1X0.2 (START)
X-0.015 (DOC)
Z-1.74 (CUT)
X0.2 (CLEAR)
Z0.1X0.2 (RESTART)
Z0.1X0.2 (START)
X-0.020 (DOC)
Z-1.735 (CUT)
X0.2 (CLEAR)
Z0.1X0.2 (RESTART)
Z0.1X0.2 (START)
X-0.025 (DOC)
Z-1.730 (CUT)
X0.2 (CLEAR)
Z0.1X0.2 (RESTART)
Z0.1X0.2 (START)
X-0.030 (DOC)
Z-1.725 (CUT)
X0.2 (CLEAR)
Z0.1X0.2 (RESTART)
Z0.1X0.2 (START)
X-0.0325 (DOC)
Z-1.720 (CUT)
X0.2 (CLEAR)
Z0.1X0.2 (RESTART)
Z0.1X0.2 (START)
X-0.035 (DOC)
Z-1.715 (CUT)
X0.2 (CLEAR)
Z0.1X0.2 (RESTART)
Z0.1X0.2 (START)
X-0.0375 (DOC)
Z-1.710 (CUT)
X0.2 (CLEAR)
Z0.1X0.2 (RESTART)
Z0.1X0.2 (START)
X-0.040 (DOC)
Z-1.705 (CUT)
X0.2 (CLEAR)
Z0.1X0.2 (RESTART)
Z0.1X0.2 (START)
X-0.0425 (DOC)
Z-1.700 (CUT)
X0.2 (CLEAR)
Z0.1X0.2 (RESTART)
Z0.1X0.2 (START)
X-0.045 (DOC)
Z-1.695 (CUT)
X0.2 (CLEAR)
Z0.1X0.2 (RESTART)
Z0.1X0.2 (START)
X-0.0475 (DOC)
Z-1.690 (CUT)
X0.2 (CLEAR)
Z0.1X0.2 (RESTART)
Z0.1X0.2 (START)
X-0.050 (DOC)
Z-1.685 (CUT)
X0.2 (CLEAR)
Z0.1X0.2 (RESTART)
Z0.1X0.2 (START)
X-0.0525 (DOC)
Z-1.680 (CUT)
X0.2 (CLEAR)
Z0.1X0.2 (RESTART)
Z0.1X0.2 (START)
X-0.055 (DOC)
Z-1.675 (CUT)
X0.2 (CLEAR)
Z0.1X0.2 (RESTART)
Z0.1X0.2 (START)
X-0.0575 (DOC)
Z-1.67 (CUT)
X0.2 (CLEAR)
Z0.1X0.2 (RESTART)
M30