586,060 active members*
4,157 visitors online*
Register for free
Login
Results 1 to 2 of 2
  1. #1
    Join Date
    May 2014
    Posts
    6

    Saving config data/ init need help kflop

    Hello, Just purchased a kflop, I have 8 ac servos hooked up and running good but really need a kickstart on getting all of my setting usable by kmotioncnc after a power cycle. (currently I have to go back into kmotion and redownload every channel ater power cycle.

    I guess I am supposed to create an Init routine that will be called from within kmotioncnc but I am not really sure were to start. All the files within kmotion\data are .txt files and not recognized by "save C to opend file" within kmotion etc.
    Can someone give me a quick rundown on how to get started. I understand C well enough to make things happen but struggling to get started.

  2. #2
    Join Date
    May 2006
    Posts
    4045

    Re: Saving config data/ init need help kflop

    Hi insightmfgsys,

    KMotion.exe has a button to auto generate C Code for you.



    Select one of your axis channels in KMotion.exe then push "C Code -> Clip Board"

    You won't see anything happen but the Windows Clipboard will now contain the C Code representation of all your settings for that axis as something like this:

    Code:
    	ch0->InputMode=NO_INPUT_MODE;
    	ch0->OutputMode=STEP_DIR_MODE;
    	ch0->Vel=115000;
    	ch0->Accel=50000;
    	ch0->Jerk=100000;
    	ch0->P=0;
    	ch0->I=0.01;
    	ch0->D=0;
    	ch0->FFAccel=0;
    	ch0->FFVel=0;
    	ch0->MaxI=200;
    	ch0->MaxErr=1e+006;
    	ch0->MaxOutput=200;
    	ch0->DeadBandGain=1;
    	ch0->DeadBandRange=0;
    	ch0->InputChan0=0;
    	ch0->InputChan1=0;
    	ch0->OutputChan0=8;
    	ch0->OutputChan1=0;
    	ch0->MasterAxis=-1;
    	ch0->LimitSwitchOptions=0x100;
    	ch0->LimitSwitchNegBit=0;
    	ch0->LimitSwitchPosBit=0;
    	ch0->SoftLimitPos=1e+030;
    	ch0->SoftLimitNeg=-1e+030;
    	ch0->InputGain0=1;
    	ch0->InputGain1=1;
    	ch0->InputOffset0=0;
    	ch0->InputOffset1=0;
    	ch0->OutputGain=1;
    	ch0->OutputOffset=0;
    	ch0->SlaveGain=1;
    	ch0->BacklashMode=BACKLASH_OFF;
    	ch0->BacklashAmount=320;
    	ch0->BacklashRate=320;
    	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.92076;
    	ch0->iir[2].A2=-0.923833;
    Notice all the the ch0-> indicates it is setting parameters for Axis #0. You can then go to the C Programs Screen and open an example Initialization C Program and "Paste" your code over the settings in the example, or if you are initializing more axes than in the example then some of your settings will need to be inserted rather than pasted over.

    Here is the example InitStepDir3Axis.c that shows 3 Axes being configured

    Code:
    #include "KMotionDef.h"
    
    // Defines axis 0, 1, 2 as simple step dir outputs
    // enables them
    // sets them as an xyz coordinate system for GCode
    
    int main() 
    {
        ch0->InputMode=ENCODER_MODE;
        ch0->OutputMode=STEP_DIR_MODE;
        ch0->Vel=40000.000000;
        ch0->Accel=400000.000000;
        ch0->Jerk=4000000.000000;
        ch0->P=0.000000;
        ch0->I=0.010000;
        ch0->D=0.000000;
        ch0->FFAccel=0.000000;
        ch0->FFVel=0.000000;
        ch0->MaxI=200.000000;
        ch0->MaxErr=1000000.000000;
        ch0->MaxOutput=200.000000;
        ch0->DeadBandGain=1.000000;
        ch0->DeadBandRange=0.000000;
        ch0->InputChan0=0;
        ch0->InputChan1=0;
        ch0->OutputChan0=0;
        ch0->OutputChan1=0;
        ch0->LimitSwitchOptions=0x0;
        ch0->InputGain0=1.000000;
        ch0->InputGain1=1.000000;
        ch0->InputOffset0=0.000000;
        ch0->InputOffset1=0.000000;
        ch0->invDistPerCycle=1.000000;
        ch0->Lead=0.000000;
        ch0->MaxFollowingError=1000000000.000000;
        ch0->StepperAmplitude=20.000000;
    
        ch0->iir[0].B0=1.000000;
        ch0->iir[0].B1=0.000000;
        ch0->iir[0].B2=0.000000;
        ch0->iir[0].A1=0.000000;
        ch0->iir[0].A2=0.000000;
    
        ch0->iir[1].B0=1.000000;
        ch0->iir[1].B1=0.000000;
        ch0->iir[1].B2=0.000000;
        ch0->iir[1].A1=0.000000;
        ch0->iir[1].A2=0.000000;
    
        ch0->iir[2].B0=0.000769;
        ch0->iir[2].B1=0.001538;
        ch0->iir[2].B2=0.000769;
        ch0->iir[2].A1=1.920810;
        ch0->iir[2].A2=-0.923885;
        EnableAxisDest(0,0);
    
        ch1->InputMode=ENCODER_MODE;
        ch1->OutputMode=STEP_DIR_MODE;
        ch1->Vel=40000.000000;
        ch1->Accel=400000.000000;
        ch1->Jerk=4000000.000000;
        ch1->P=0.000000;
        ch1->I=0.010000;
        ch1->D=0.000000;
        ch1->FFAccel=0.000000;
        ch1->FFVel=0.000000;
        ch1->MaxI=200.000000;
        ch1->MaxErr=1000000.000000;
        ch1->MaxOutput=200.000000;
        ch1->DeadBandGain=1.000000;
        ch1->DeadBandRange=0.000000;
        ch1->InputChan0=1;
        ch1->InputChan1=0;
        ch1->OutputChan0=1;
        ch1->OutputChan1=0;
        ch1->LimitSwitchOptions=0x0;
        ch1->InputGain0=1.000000;
        ch1->InputGain1=1.000000;
        ch1->InputOffset0=0.000000;
        ch1->InputOffset1=0.000000;
        ch1->invDistPerCycle=1.000000;
        ch1->Lead=0.000000;
        ch1->MaxFollowingError=1000000000.000000;
        ch1->StepperAmplitude=20.000000;
    
        ch1->iir[0].B0=1.000000;
        ch1->iir[0].B1=0.000000;
        ch1->iir[0].B2=0.000000;
        ch1->iir[0].A1=0.000000;
        ch1->iir[0].A2=0.000000;
    
        ch1->iir[1].B0=1.000000;
        ch1->iir[1].B1=0.000000;
        ch1->iir[1].B2=0.000000;
        ch1->iir[1].A1=0.000000;
        ch1->iir[1].A2=0.000000;
    
        ch1->iir[2].B0=0.000769;
        ch1->iir[2].B1=0.001538;
        ch1->iir[2].B2=0.000769;
        ch1->iir[2].A1=1.920810;
        ch1->iir[2].A2=-0.923885;
        EnableAxisDest(1,0);
    
        ch2->InputMode=ENCODER_MODE;
        ch2->OutputMode=STEP_DIR_MODE;
        ch2->Vel=40000.000000;
        ch2->Accel=400000.000000;
        ch2->Jerk=4000000.000000;
        ch2->P=0.000000;
        ch2->I=0.010000;
        ch2->D=0.000000;
        ch2->FFAccel=0.000000;
        ch2->FFVel=0.000000;
        ch2->MaxI=200.000000;
        ch2->MaxErr=1000000.000000;
        ch2->MaxOutput=200.000000;
        ch2->DeadBandGain=1.000000;
        ch2->DeadBandRange=0.000000;
        ch2->InputChan0=2;
        ch2->InputChan1=0;
        ch2->OutputChan0=2;
        ch2->OutputChan1=0;
        ch2->LimitSwitchOptions=0x0;
        ch2->InputGain0=1.000000;
        ch2->InputGain1=1.000000;
        ch2->InputOffset0=0.000000;
        ch2->InputOffset1=0.000000;
        ch2->invDistPerCycle=1.000000;
        ch2->Lead=0.000000;
        ch2->MaxFollowingError=1000000000.000000;
        ch2->StepperAmplitude=20.000000;
    
        ch2->iir[0].B0=1.000000;
        ch2->iir[0].B1=0.000000;
        ch2->iir[0].B2=0.000000;
        ch2->iir[0].A1=0.000000;
        ch2->iir[0].A2=0.000000;
    
        ch2->iir[1].B0=1.000000;
        ch2->iir[1].B1=0.000000;
        ch2->iir[1].B2=0.000000;
        ch2->iir[1].A1=0.000000;
        ch2->iir[1].A2=0.000000;
    
        ch2->iir[2].B0=0.000769;
        ch2->iir[2].B1=0.001538;
        ch2->iir[2].B2=0.000769;
        ch2->iir[2].A1=1.920810;
        ch2->iir[2].A2=-0.923885;
        EnableAxisDest(2,0);
    
        DefineCoordSystem(0,1,2,-1);
    
        return 0;
    }
    You can find more information on how to quickly import or export settings between the KMotion Screens and a C Program here:

    Besides setting Axis Parameters an Initialization Program can do other things to initialize your system. Typically an Initialization Program will do:

    #1 - Set All Axis Parameters
    #2 - Enable All Axes ie. EnableAxisDest(0,0);
    #3 - Define which axes are to be used in GCode ie DefineCoordSystem(0,1,2,-1);
    #4 - Perform a Service Loop to Service/Monitor things like MPGs, EStop, External Buttons, etc...

    After creating the C Program, add a button to whatever Application you are using (KmotionCNC, Mach3, etc) to Execute the C Program.

    For KMotionCNC in Tool Setup | User Buttons | Define something like:



    HTH
    Regards
    TK
    http://dynomotion.com

Similar Threads

  1. kflop by itself?
    By markymark1 in forum Dynomotion/Kflop/Kanalog
    Replies: 4
    Last Post: 04-20-2014, 07:19 PM
  2. Converting cloud point data from 3d scan to usable rhino data
    By LuthierWizard in forum Musical Instrument Design and Construction
    Replies: 3
    Last Post: 04-16-2014, 02:25 PM
  3. KFlop 4.3
    By John Coloccia in forum Dynomotion/Kflop/Kanalog
    Replies: 3
    Last Post: 05-03-2013, 07:57 PM
  4. Help config 5 axis kflop
    By fabiopr2409 in forum Dynomotion/Kflop/Kanalog
    Replies: 1
    Last Post: 03-10-2013, 11:32 PM
  5. CNC Series 8600 ''Init Aborted
    By baba1511 in forum European Club House
    Replies: 0
    Last Post: 01-28-2010, 01:32 AM

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
  •