KFLOP to VFD 0-10V


Results 1 to 4 of 4

Thread: KFLOP to VFD 0-10V

  1. #1
    Member
    Join Date
    Jan 2013
    Location
    Canada
    Posts
    73
    Downloads
    0
    Uploads
    0

    Question KFLOP to VFD 0-10V

    Good day, I would like to connect KFLOP to VFD of the 18000rpm ATC spindle.
    I used JP6 pin7 IO28 on KFLOP as PWM output and connected it to (PWM to Analog (0-10V) Converter Module) (example link: https://opencircuit.shop/product/pwm...nverter-module)
    When I use the Digital IO screen screen and set the bit HIGH I get the max RPM on my spindle about 600HZ
    How should I set the Tool Setup Screen for S on Kmotion so I can use S1000 for 1000rpm, does it need to be in C program or can I do it with DAC option?
    If the only option is with C program, can you help me with C program example?
    Thank you very much.
    Best regards.

    KFLOP to VFD 0-10V-kflop-spindle-jpg

    Similar Threads:


  2. #2
    Member TomKerekes's Avatar
    Join Date
    May 2006
    Location
    USA
    Posts
    4043
    Downloads
    0
    Uploads
    0

    Default Re: KFLOP to VFD 0-10V

    Yes a C Program is required.

    See the SpindlePWM.c and SpindlePWMoff.c examples

    Since you are using PWM #2 instead of #0 and each PWM has 2 control registers add 2x2=4 to the FPGA Addresses like this:

    Code:
    	FPGA(IO_PWMS+2*2+1) = 1;    // enable the PWM
    	FPGA(IO_PWMS+2*2)   = pwm;  // set the PWM
    You might also read this Thread. Although it relates to Mach3 the technique is the similar.

    Regards
    TK http://dynomotion.com


  3. #3
    Community Moderator Al_The_Man's Avatar
    Join Date
    Dec 2003
    Location
    Canada
    Posts
    24216
    Downloads
    0
    Uploads
    0

    Default Re: KFLOP to VFD 0-10V

    Can Kflop PWM spindle control go down to a freq of 20Hz?

    CNC, Mechatronics Integration and Custom Machine Design

    “Logic will get you from A to B. Imagination will take you everywhere.”
    Albert E.


  4. #4
    Member TomKerekes's Avatar
    Join Date
    May 2006
    Location
    USA
    Posts
    4043
    Downloads
    0
    Uploads
    0

    Default Re: KFLOP to VFD 0-10V

    Hi Al,

    Can Kflop PWM spindle control go down to a freq of 20Hz?
    254Hz is the minimum for the 8-bit hardware PWMs.

    But Software (User Call Back) can switch an IO with resolution of 90us. At 20Hz that provides a resolution of 0.18%

    Our new Kogna Controller has Hi-Resolution PWMs clocking at 228MHz with 32-bit Period and Pulse registers so can do most any frequency.

    Regards
    TK http://dynomotion.com


  5. #5
    Member
    Join Date
    Jan 2013
    Location
    Canada
    Posts
    73
    Downloads
    0
    Uploads
    0

    Default Re: KFLOP to VFD 0-10V

    Good day Tom, and thank you for fast reply.
    I did try with C program but it doesn`t work.

    CODE:
    #include "KMotionDef.h"

    #define MAX_RPM 18000.0f

    // drive PWM 2 as spindle
    //

    // PWM 2 is KFLOP IO bit #28
    // JP6 Aux#1 Pin 7

    main()
    {
    int pwm;
    float speed = *(float *)&persist.UserData[0]; // value stored is actually a float

    pwm = speed/MAX_RPM * 255.0f;

    if (pwm > 255) pwm=255; // limit to max pwm value

    printf("Spindle Set to %f pwm %d\n",speed, pwm); // print the desired speed

    FPGA(IO_PWMS+2*2+1) = 1; // enable the PWM
    FPGA(IO_PWMS+2*2) = pwm; // set the PWM

    }
    Attachment 492825

    Also I have another question. I believe since I set pins 26, 27, 28 as outputs my machine has gone mad.
    In the middle of the program one of the slaved axis doesn`t follow the other. I tried couple of time with VFD ON, with VFD unplugged and the machine always did the same.

    Then I unchecked the 26,27,28 outputs in DIGITAL I/O screen and it seems to work now.
    Do I need to install filters capacitors on outputs also? Or any other suggestion?

    Thank you.



  6. #6
    Member
    Join Date
    Jan 2013
    Location
    Canada
    Posts
    73
    Downloads
    0
    Uploads
    0

    Default Re: KFLOP to VFD 0-10V

    Today I tested machine some more and the gantry Y axis is acting weird.
    In the middle of program they started to move sporadically.
    Could there be something wrong with the INIT file?

    INIT:
    #include "KMotionDef.h"

    // Configuration and Homing program for a 3 axis System
    // Limit switches are disabled and used as a home switch
    // then they are re-enabled



    main()
    {
    DefineCoordSystem(0,1,3,-1);
    //Define XYZ coordinated motion axes

    //place to save limit switch settings
    //int SaveXLimits;
    //int SaveY1Limits;
    //int SaveY2Limits;
    //int SaveZLimits;
    //int SaveALimits;
    //int SaveCLimits;

    //DisableAxis(0); //X
    //DisableAxis(1); //Y1
    //DisableAxis(2); //Y2
    //DisableAxis(3); //Z
    //DisableAxis(4); //A
    //DisableAxis(5); //C

    // Set the axis parameters here
    // after everything is configured in the KMotion Screens
    // use copy C Code to clipboard on the configuration screen
    // then paste here. Repeat for each axis


    //X - POPRECNO
    ch0->InputMode=NO_INPUT_MODE;
    ch0->OutputMode=STEP_DIR_MODE;
    ch0->Vel=192000;
    ch0->Accel=1e+07;
    ch0->Jerk=1e+07;
    ch0->P=0;
    ch0->I=0;
    ch0->D=0;
    ch0->FFAccel=0;
    ch0->FFVel=0;
    ch0->MaxI=100;
    ch0->MaxErr=100;
    ch0->MaxOutput=100;
    ch0->DeadBandGain=0;
    ch0->DeadBandRange=0;
    ch0->InputChan0=0;
    ch0->InputChan1=0;
    ch0->OutputChan0=8;
    ch0->OutputChan1=0;
    ch0->MasterAxis=-1;
    ch0->LimitSwitchOptions=0x115;
    ch0->LimitSwitchNegBit=0;
    ch0->LimitSwitchPosBit=0;
    ch0->SoftLimitPos=1e+09;
    ch0->SoftLimitNeg=-1e+09;
    ch0->InputGain0=0;
    ch0->InputGain1=1;
    ch0->InputOffset0=0;
    ch0->InputOffset1=0;
    ch0->OutputGain=1;
    ch0->OutputOffset=0;
    ch0->SlaveGain=1;
    ch0->BacklashMode=BACKLASH_OFF;
    ch0->BacklashAmount=0;
    ch0->BacklashRate=0;
    ch0->invDistPerCycle=1;
    ch0->Lead=0;
    ch0->MaxFollowingError=1000000000;
    ch0->StepperAmplitude=20;

    ch0->iir[0].B0=1;
    ch0->iir[0].B1=0;
    ch0->iir[0].B2=0;
    ch0->iir[0].A1=0;
    ch0->iir[0].A2=0;

    ch0->iir[1].B0=1;
    ch0->iir[1].B1=0;
    ch0->iir[1].B2=0;
    ch0->iir[1].A1=0;
    ch0->iir[1].A2=0;

    ch0->iir[2].B0=0.000769;
    ch0->iir[2].B1=0.001538;
    ch0->iir[2].B2=0.000769;
    ch0->iir[2].A1=1.92081;
    ch0->iir[2].A2=-0.923885;
    //EnableAxisDest(0,0);

    //Y1 - LIJEVO
    ch1->InputMode=NO_INPUT_MODE;
    ch1->OutputMode=STEP_DIR_MODE;
    ch1->Vel=192000;
    ch1->Accel=1e+07;
    ch1->Jerk=1e+07;
    ch1->P=0;
    ch1->I=0;
    ch1->D=0;
    ch1->FFAccel=0;
    ch1->FFVel=0;
    ch1->MaxI=100;
    ch1->MaxErr=100;
    ch1->MaxOutput=100;
    ch1->DeadBandGain=1;
    ch1->DeadBandRange=0;
    ch1->InputChan0=0;
    ch1->InputChan1=0;
    ch1->OutputChan0=9;
    ch1->OutputChan1=0;
    ch1->MasterAxis=-1;
    ch1->LimitSwitchOptions=0x115;
    ch1->LimitSwitchNegBit=1;
    ch1->LimitSwitchPosBit=0;
    ch1->SoftLimitPos=1e+09;
    ch1->SoftLimitNeg=-1e+09;
    ch1->InputGain0=0;
    ch1->InputGain1=1;
    ch1->InputOffset0=0;
    ch1->InputOffset1=0;
    ch1->OutputGain=1;
    ch1->OutputOffset=0;
    ch1->SlaveGain=1;
    ch1->BacklashMode=BACKLASH_OFF;
    ch1->BacklashAmount=0;
    ch1->BacklashRate=0;
    ch1->invDistPerCycle=1;
    ch1->Lead=0;
    ch1->MaxFollowingError=1000000000;
    ch1->StepperAmplitude=20;

    ch1->iir[0].B0=1;
    ch1->iir[0].B1=0;
    ch1->iir[0].B2=0;
    ch1->iir[0].A1=0;
    ch1->iir[0].A2=0;

    ch1->iir[1].B0=1;
    ch1->iir[1].B1=0;
    ch1->iir[1].B2=0;
    ch1->iir[1].A1=0;
    ch1->iir[1].A2=0;

    ch1->iir[2].B0=0.000769;
    ch1->iir[2].B1=0.001538;
    ch1->iir[2].B2=0.000769;
    ch1->iir[2].A1=1.92081;
    ch1->iir[2].A2=-0.923885;
    //EnableAxisDest(1,0);

    //Y2 - DESNO
    ch2->InputMode=NO_INPUT_MODE;
    ch2->OutputMode=STEP_DIR_MODE;
    ch2->Vel=192000;
    ch2->Accel=1e+07;
    ch2->Jerk=1e+07;
    ch2->P=0;
    ch2->I=0;
    ch2->D=0;
    ch2->FFAccel=0;
    ch2->FFVel=0;
    ch2->MaxI=100;
    ch2->MaxErr=100;
    ch2->MaxOutput=100;
    ch2->DeadBandGain=1;
    ch2->DeadBandRange=0;
    ch2->InputChan0=0;
    ch2->InputChan1=2;
    ch2->OutputChan0=10;
    ch2->OutputChan1=5;
    ch2->MasterAxis=1;
    ch2->LimitSwitchOptions=0x115;
    ch2->LimitSwitchNegBit=2;
    ch2->LimitSwitchPosBit=0;
    ch2->SoftLimitPos=1e+09;
    ch2->SoftLimitNeg=-1e+09;
    ch2->InputGain0=0;
    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=1;
    ch2->Lead=0;
    ch2->MaxFollowingError=1000000000;
    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;
    //EnableAxisDest(2,0);

    //Z
    ch3->InputMode=NO_INPUT_MODE;
    ch3->OutputMode=STEP_DIR_MODE;
    ch3->Vel=128000;
    ch3->Accel=1e+07;
    ch3->Jerk=1e+07;
    ch3->P=0;
    ch3->I=0;
    ch3->D=0;
    ch3->FFAccel=0;
    ch3->FFVel=0;
    ch3->MaxI=100;
    ch3->MaxErr=100;
    ch3->MaxOutput=100;
    ch3->DeadBandGain=0;
    ch3->DeadBandRange=0;
    ch3->InputChan0=0;
    ch3->InputChan1=3;
    ch3->OutputChan0=11;
    ch3->OutputChan1=7;
    ch3->MasterAxis=-1;
    ch3->LimitSwitchOptions=0x11a;
    ch3->LimitSwitchNegBit=0;
    ch3->LimitSwitchPosBit=3;
    ch3->SoftLimitPos=1e+09;
    ch3->SoftLimitNeg=-1e+09;
    ch3->InputGain0=0;
    ch3->InputGain1=1;
    ch3->InputOffset0=0;
    ch3->InputOffset1=0;
    ch3->OutputGain=1;
    ch3->OutputOffset=0;
    ch3->SlaveGain=1;
    ch3->BacklashMode=BACKLASH_OFF;
    ch3->BacklashAmount=0;
    ch3->BacklashRate=0;
    ch3->invDistPerCycle=1;
    ch3->Lead=0;
    ch3->MaxFollowingError=1000000000;
    ch3->StepperAmplitude=20;

    ch3->iir[0].B0=1;
    ch3->iir[0].B1=0;
    ch3->iir[0].B2=0;
    ch3->iir[0].A1=0;
    ch3->iir[0].A2=0;

    ch3->iir[1].B0=1;
    ch3->iir[1].B1=0;
    ch3->iir[1].B2=0;
    ch3->iir[1].A1=0;
    ch3->iir[1].A2=0;

    ch3->iir[2].B0=1;
    ch3->iir[2].B1=0;
    ch3->iir[2].B2=0;
    ch3->iir[2].A1=0;
    ch3->iir[2].A2=0;
    //EnableAxis(3,0);


    // enable all 3 axes and begin servoing where we are
    EnableAxis(0); //X
    EnableAxis(1); //Y1
    EnableAxis(2); //Y2
    EnableAxis(3); //Z
    //EnableAxis(4);
    //EnableAxis(5);

    //SetBitDirection (26,1); // set bit as output SPINDLE CW
    //SetBitDirection (27,1); // set bit as output SPINDLE CCW
    //SetBitDirection (28,1); // set bit as output SPINDLE RPM

    }

    HOMING:
    #include "KMotionDef.h"

    // Configuration and Homing program for a 3 axis System
    // Limit switches are disabled and used as a home switch
    // then they are re-enabled



    main()
    {
    DefineCoordSystem(0,1,3,-1);
    //Define XYZ coordinated motion axes

    //place to save limit switch settings
    int SaveXLimits;
    int SaveY1Limits;
    int SaveY2Limits;
    int SaveZLimits;
    //int SaveALimits;
    //int SaveCLimits;

    //DisableAxis(0); //X
    //DisableAxis(1); //Y1
    //DisableAxis(2); //Y2
    //DisableAxis(3); //Z
    //DisableAxis(4); //A
    //DisableAxis(5); //C

    // Set the axis parameters here
    // after everything is configured in the KMotion Screens
    // use copy C Code to clipboard on the configuration screen
    // then paste here. Repeat for each axis


    //X - POPRECNO
    ch0->InputMode=NO_INPUT_MODE;
    ch0->OutputMode=STEP_DIR_MODE;
    ch0->Vel=192000;
    ch0->Accel=1e+07;
    ch0->Jerk=1e+07;
    ch0->P=0;
    ch0->I=0;
    ch0->D=0;
    ch0->FFAccel=0;
    ch0->FFVel=0;
    ch0->MaxI=100;
    ch0->MaxErr=100;
    ch0->MaxOutput=100;
    ch0->DeadBandGain=0;
    ch0->DeadBandRange=0;
    ch0->InputChan0=0;
    ch0->InputChan1=0;
    ch0->OutputChan0=8;
    ch0->OutputChan1=0;
    ch0->MasterAxis=-1;
    ch0->LimitSwitchOptions=0x115;
    ch0->LimitSwitchNegBit=0;
    ch0->LimitSwitchPosBit=0;
    ch0->SoftLimitPos=1e+09;
    ch0->SoftLimitNeg=-1e+09;
    ch0->InputGain0=0;
    ch0->InputGain1=1;
    ch0->InputOffset0=0;
    ch0->InputOffset1=0;
    ch0->OutputGain=1;
    ch0->OutputOffset=0;
    ch0->SlaveGain=1;
    ch0->BacklashMode=BACKLASH_OFF;
    ch0->BacklashAmount=0;
    ch0->BacklashRate=0;
    ch0->invDistPerCycle=1;
    ch0->Lead=0;
    ch0->MaxFollowingError=1000000000;
    ch0->StepperAmplitude=20;

    ch0->iir[0].B0=1;
    ch0->iir[0].B1=0;
    ch0->iir[0].B2=0;
    ch0->iir[0].A1=0;
    ch0->iir[0].A2=0;

    ch0->iir[1].B0=1;
    ch0->iir[1].B1=0;
    ch0->iir[1].B2=0;
    ch0->iir[1].A1=0;
    ch0->iir[1].A2=0;

    ch0->iir[2].B0=0.000769;
    ch0->iir[2].B1=0.001538;
    ch0->iir[2].B2=0.000769;
    ch0->iir[2].A1=1.92081;
    ch0->iir[2].A2=-0.923885;
    //EnableAxisDest(0,0);

    //Y1 - LIJEVO
    ch1->InputMode=NO_INPUT_MODE;
    ch1->OutputMode=STEP_DIR_MODE;
    ch1->Vel=192000;
    ch1->Accel=1e+07;
    ch1->Jerk=1e+07;
    ch1->P=0;
    ch1->I=0;
    ch1->D=0;
    ch1->FFAccel=0;
    ch1->FFVel=0;
    ch1->MaxI=100;
    ch1->MaxErr=100;
    ch1->MaxOutput=100;
    ch1->DeadBandGain=1;
    ch1->DeadBandRange=0;
    ch1->InputChan0=0;
    ch1->InputChan1=0;
    ch1->OutputChan0=9;
    ch1->OutputChan1=0;
    ch1->MasterAxis=-1;
    ch1->LimitSwitchOptions=0x115;
    ch1->LimitSwitchNegBit=1;
    ch1->LimitSwitchPosBit=0;
    ch1->SoftLimitPos=1e+09;
    ch1->SoftLimitNeg=-1e+09;
    ch1->InputGain0=0;
    ch1->InputGain1=1;
    ch1->InputOffset0=0;
    ch1->InputOffset1=0;
    ch1->OutputGain=1;
    ch1->OutputOffset=0;
    ch1->SlaveGain=1;
    ch1->BacklashMode=BACKLASH_OFF;
    ch1->BacklashAmount=0;
    ch1->BacklashRate=0;
    ch1->invDistPerCycle=1;
    ch1->Lead=0;
    ch1->MaxFollowingError=1000000000;
    ch1->StepperAmplitude=20;

    ch1->iir[0].B0=1;
    ch1->iir[0].B1=0;
    ch1->iir[0].B2=0;
    ch1->iir[0].A1=0;
    ch1->iir[0].A2=0;

    ch1->iir[1].B0=1;
    ch1->iir[1].B1=0;
    ch1->iir[1].B2=0;
    ch1->iir[1].A1=0;
    ch1->iir[1].A2=0;

    ch1->iir[2].B0=0.000769;
    ch1->iir[2].B1=0.001538;
    ch1->iir[2].B2=0.000769;
    ch1->iir[2].A1=1.92081;
    ch1->iir[2].A2=-0.923885;
    //EnableAxisDest(1,0);

    //Y2 - DESNO
    ch2->InputMode=NO_INPUT_MODE;
    ch2->OutputMode=STEP_DIR_MODE;
    ch2->Vel=192000;
    ch2->Accel=1e+07;
    ch2->Jerk=1e+07;
    ch2->P=0;
    ch2->I=0;
    ch2->D=0;
    ch2->FFAccel=0;
    ch2->FFVel=0;
    ch2->MaxI=100;
    ch2->MaxErr=100;
    ch2->MaxOutput=100;
    ch2->DeadBandGain=1;
    ch2->DeadBandRange=0;
    ch2->InputChan0=0;
    ch2->InputChan1=2;
    ch2->OutputChan0=10;
    ch2->OutputChan1=5;
    ch2->MasterAxis=1;
    ch2->LimitSwitchOptions=0x115;
    ch2->LimitSwitchNegBit=2;
    ch2->LimitSwitchPosBit=0;
    ch2->SoftLimitPos=1e+09;
    ch2->SoftLimitNeg=-1e+09;
    ch2->InputGain0=0;
    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=1;
    ch2->Lead=0;
    ch2->MaxFollowingError=1000000000;
    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;
    //EnableAxisDest(2,0);

    //Z
    ch3->InputMode=NO_INPUT_MODE;
    ch3->OutputMode=STEP_DIR_MODE;
    ch3->Vel=128000;
    ch3->Accel=1e+07;
    ch3->Jerk=1e+07;
    ch3->P=0;
    ch3->I=0;
    ch3->D=0;
    ch3->FFAccel=0;
    ch3->FFVel=0;
    ch3->MaxI=100;
    ch3->MaxErr=100;
    ch3->MaxOutput=100;
    ch3->DeadBandGain=0;
    ch3->DeadBandRange=0;
    ch3->InputChan0=0;
    ch3->InputChan1=3;
    ch3->OutputChan0=11;
    ch3->OutputChan1=7;
    ch3->MasterAxis=-1;
    ch3->LimitSwitchOptions=0x11a;
    ch3->LimitSwitchNegBit=0;
    ch3->LimitSwitchPosBit=3;
    ch3->SoftLimitPos=1e+09;
    ch3->SoftLimitNeg=-1e+09;
    ch3->InputGain0=0;
    ch3->InputGain1=1;
    ch3->InputOffset0=0;
    ch3->InputOffset1=0;
    ch3->OutputGain=1;
    ch3->OutputOffset=0;
    ch3->SlaveGain=1;
    ch3->BacklashMode=BACKLASH_OFF;
    ch3->BacklashAmount=0;
    ch3->BacklashRate=0;
    ch3->invDistPerCycle=1;
    ch3->Lead=0;
    ch3->MaxFollowingError=1000000000;
    ch3->StepperAmplitude=20;

    ch3->iir[0].B0=1;
    ch3->iir[0].B1=0;
    ch3->iir[0].B2=0;
    ch3->iir[0].A1=0;
    ch3->iir[0].A2=0;

    ch3->iir[1].B0=1;
    ch3->iir[1].B1=0;
    ch3->iir[1].B2=0;
    ch3->iir[1].A1=0;
    ch3->iir[1].A2=0;

    ch3->iir[2].B0=1;
    ch3->iir[2].B1=0;
    ch3->iir[2].B2=0;
    ch3->iir[2].A1=0;
    ch3->iir[2].A2=0;
    //EnableAxis(3,0);


    // disable the limits (first save how they were set)
    SaveXLimits = ch0->LimitSwitchOptions;
    SaveY1Limits = ch1->LimitSwitchOptions;
    SaveY2Limits = ch2->LimitSwitchOptions;
    SaveZLimits = ch3->LimitSwitchOptions;

    ch0->LimitSwitchOptions = 0; //X
    ch1->LimitSwitchOptions = 0; //Y1
    ch2->LimitSwitchOptions = 0; //Y2
    ch3->LimitSwitchOptions = 0; //Z

    // enable all 3 axes and begin servoing where we are


    EnableAxis(0); //X
    EnableAxis(1); //Y1
    EnableAxis(2); //Y2
    EnableAxis(3); //Z
    //EnableAxis(4);
    //EnableAxis(5);

    //Z-AXIS
    //HOME Z-AXIS FAST
    Jog(3,20000); // jog FAST POSITIV
    while (ReadBit(3)) ; // loop until IO bit goes high
    Jog(3,0); // stop
    while (!CheckDone(3)) ; // loop until motion completes
    DisableAxis(3); // disable the axis
    Zero(3); // Zero the position
    EnableAxis(3); // re-enable the ServoTick
    Move(3,-3200); // move 2.5mm inside the limits
    while (!CheckDone(3)) ; // loop until motion completes
    //ch3->LimitSwitchOptions = SaveZLimits;

    //HOME Z-AXIS 2nd TIME SLOWER
    Jog(3,3200); // jog slowly POSITIV
    while (ReadBit(3)) ; // loop until IO bit goes high
    Jog(3,0); // stop
    while (!CheckDone(3)) ; // loop until motion completes
    DisableAxis(3); // disable the axis
    Zero(3); // Zero the position
    EnableAxis(3); // re-enable the ServoTick
    Move(3,-6400); // (Steps/mm = 642.5803842) move 5mm inside the limits
    while (!CheckDone(3)) ; // loop until motion completes

    ch3->LimitSwitchOptions = SaveZLimits; // restore limit settings
    //Z-AXIS END


    //HOME X-AXIS FAST
    Jog(0,-20000); // jog FAST NEGATIVE
    while (ReadBit(0)) ; // loop until IO bit goes high
    Jog(0,0); // stop
    while (!CheckDone(0)) ; // loop until motion completes
    DisableAxis(0); // disable the axis
    Zero(0); // Zero the position
    EnableAxis(0); // re-enable the ServoTick
    Move(0,3200); // move 2.5mm inside the limits
    while (!CheckDone(0)) ; // loop until motion completes
    //ch0->LimitSwitchOptions = SaveXLimits;

    //HOME X-AXIS 2nd TIME SLOWER
    Jog(0,-3200); // jog slowly NEGATIVE
    while (ReadBit(0)) ; // loop until IO bit goes high
    Jog(0,0); // stop
    while (!CheckDone(0)) ; // loop until motion completes
    DisableAxis(0); // disable the axis
    Zero(0); // Zero the position
    EnableAxis(0); // re-enable the ServoTick
    Move(0,6400); // (Steps/mm = 646.2833146) move some amount inside the limits
    while (!CheckDone(0)) ; // loop until motion completes

    ch0->LimitSwitchOptions = SaveXLimits; // restore limit settings
    //X-AXIS END


    //Y-SQUARE START
    //HOME Y-AXIS FAST
    Jog(1,-20000); // jog FAST NEGATIVE Y1
    while (ReadBit(1) && ReadBit(2)) ; // loop until IO bit goes high
    Jog(1,0); // stop
    while (!CheckDone(1)) ; // loop until motion completes
    DisableAxis(1); // disable the axis
    Zero(1); // Zero the position
    EnableAxis(1); // re-enable the ServoTick
    Move(1,3200); // move 5mm inside the limits
    while (!CheckDone(1)) ; // loop until motion completes
    //ch1->LimitSwitchOptions = SaveY1Limits;

    //HOME Y-AXIS 2nd TIME SLOWER
    ch1->MasterAxis=-1; //DESLAVE AXIS

    //SQUARING Y1
    Jog(1,-3200); // jog Y1 slow NEGATIVE
    while (ReadBit(1)) ; // loop until IO bit goes high
    Jog(1,0); // stop
    while (!CheckDone(1)) ; // loop until motion completes
    DisableAxis(1); // disable the axis

    //SQUARING Y2
    Jog(2,-3200); // jog X1 slow NEGATIVE
    while (ReadBit(2)) ; // loop until IO bit goes high
    Jog(2,0); // stop
    while (!CheckDone(2)) ; // loop until motion completes
    DisableAxis(2); // disable the axis
    //
    //
    //
    ch1->MasterAxis=1; //SLAVE AXIS
    Zero(1); // Zero the position of axis 1
    EnableAxis(1); // re-enable the ServoTick
    EnableAxis(2); // re-enable the ServoTick
    Move(1,6400); // (Steps/mm = 646.3438727) x 5 = 5mm - move 5mm inside the limits
    while (!CheckDone(1)) ; // loop until motion completes

    ch1->LimitSwitchOptions = SaveY1Limits; // restore limit settings
    //X-SQUARE END

    DefineCoordSystem(0,1,3,-1);//Define XYZ coordinated motion axes

    }



Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


About CNCzone.com

    We are the largest and most active discussion forum for manufacturing industry. The site is 100% free to join and use, so join today!

Follow us on


Our Brands

KFLOP to VFD 0-10V

KFLOP to VFD 0-10V