. .

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    For F*ck's sake Tommy give it a rest.
    You have posted on every web site known to man including the stray cats website.
    If anyone has one of these boards they will be severely tempted to throw it in the skip just so you can't get yours hands on it.
    John S -

  2. #2
    Quote Originally Posted by John S View Post
    For F*ck's sake Tommy give it a rest.
    You have posted on every web site known to man including the stray cats website.
    If anyone has one of these boards they will be severely tempted to throw it in the skip just so you can't get yours hands on it.
    My sincere apologies to John S.

  3. #3
    Graciously accepted.
    John S -

  4. #4
    Quote Originally Posted by John S View Post
    For F*ck's sake Tommy give it a rest.
    You have posted on every web site known to man including the stray cats website.
    If anyone has one of these boards they will be severely tempted to throw it in the skip just so you can't get yours hands on it.
    Piss my shit

  5. #5
    m_c's Avatar
    Lives in East Lothian, United Kingdom. Last Activity: 9 Hours Ago Forum Superstar, has done so much to help others, they deserve a medal. Has a total post count of 2,964. Received thanks 368 times, giving thanks to others 8 times.
    So dragging this back on topic, I'll quickly cover the seemingly mysterious world of configuring a KFlop to do the basics.

    There is no denying the KFlop can appear very complex, but it's not that much more complex than using any other controller. The key thing is, whereas programs like Mach have configuration options spread over various screens which create/update your machine configuration file, you have to create the equivalent KFlop configuration file yourself. However, the included KMotion software has various screens/functions to help you create the needed parameters, and several example files are included.

    I'll start with the basic file I used to get basic motion.
    Code:
    #include "KMotionDef.h"
    
    main()
    {
    	
    	ch1->InputMode=NO_INPUT_MODE;
    	ch1->OutputMode=STEP_DIR_MODE;
    	ch1->Vel=40000;
    	ch1->Accel=400000;
    	ch1->Jerk=4e+06;
    	ch1->P=0;
    	ch1->I=0.01;
    	ch1->D=0;
    	ch1->FFAccel=0;
    	ch1->FFVel=0;
    	ch1->MaxI=200;
    	ch1->MaxErr=1e+06;
    	ch1->MaxOutput=200;
    	ch1->DeadBandGain=1;
    	ch1->DeadBandRange=0;
    	ch1->InputChan0=1;
    	ch1->InputChan1=0;
    	ch1->OutputChan0=13;
    	ch1->OutputChan1=0;
    	ch1->MasterAxis=-1;
    	ch1->LimitSwitchOptions=0x100;
    	ch1->LimitSwitchNegBit=0;
    	ch1->LimitSwitchPosBit=0;
    	ch1->SoftLimitPos=1e+09;
    	ch1->SoftLimitNeg=-1e+09;
    	ch1->InputGain0=1;
    	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;
    	
    	ch2->InputMode=NO_INPUT_MODE;
    	ch2->OutputMode=STEP_DIR_MODE;
    	ch2->Vel=40000;
    	ch2->Accel=400000;
    	ch2->Jerk=4e+06;
    	ch2->P=0;
    	ch2->I=0.01;
    	ch2->D=0;
    	ch2->FFAccel=0;
    	ch2->FFVel=0;
    	ch2->MaxI=200;
    	ch2->MaxErr=1e+06;
    	ch2->MaxOutput=200;
    	ch2->DeadBandGain=1;
    	ch2->DeadBandRange=0;
    	ch2->InputChan0=2;
    	ch2->InputChan1=0;
    	ch2->OutputChan0=14;
    	ch2->OutputChan1=0;
    	ch2->MasterAxis=-1;
    	ch2->LimitSwitchOptions=0x100;
    	ch2->LimitSwitchNegBit=0;
    	ch2->LimitSwitchPosBit=0;
    	ch2->SoftLimitPos=1e+09;
    	ch2->SoftLimitNeg=-1e+09;
    	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=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=0.000769;
    	ch2->iir[2].B1=0.001538;
    	ch2->iir[2].B2=0.000769;
    	ch2->iir[2].A1=1.92081;
    	ch2->iir[2].A2=-0.923885;
    
    	EnableAxis(0);
    	EnableAxis(1);
    	EnableAxis(2);
    	
    	FPGA(STEP_PULSE_LENGTH_ADD)=63;  // set the pulse time to ~ 5.xus
    	DefineCoordSystem(0,1,2,-1);
    	
    	InitAux();
    
    	AddKonnect(0,&VirtualBitsEx,VirtualBitsEx+1);
    
        return 0;
    
    }
    It looks complex, but I'll break it down.
    You have three sets of channel configuration data (one for each axis in this case). These set all the possible parameters for each channel.
    To create this information, within the Config function in KMotion, you use the various dropdown boxes and boxes to select/enter the information. You can then download the information to the KFlop to test (this can be done on the fly), and then once you're happy, you can copy the information to the clipboard, and paste it into your init.c file (init.c is the generic name used to reference your initialisation file - the file can be called whatever you want, but for simplicity it's gets called this).
    Although not needed for this, if you were to use some form of closed loop, there is the Step Response screen for tuning servos and carrying out test moves, an IIR Filter screen for applying filters to closed loops, and a Bode Plot screen for generating test plots to see in detail how the closed loop is performing.

    For a basic step/dir system such as this, there are only 6 lines that need to be set, which I've highlighted in bold below-
    Code:
    	ch0->InputMode=NO_INPUT_MODE;  Sets open loop mode
    	ch0->OutputMode=STEP_DIR_MODE; Sets Step dir output
    	ch0->Vel=40000; Sets maximum velocity
    	ch0->Accel=400000; Sets Acceleration
    	ch0->Jerk=4e+06; Sets Max Jerk
    	ch0->P=0;
    	ch0->I=0.01;
    	ch0->D=0;
    	ch0->FFAccel=0;
    	ch0->FFVel=0;
    	ch0->MaxI=200;
    	ch0->MaxErr=1e+06;
    	ch0->MaxOutput=200;
    	ch0->DeadBandGain=1;
    	ch0->DeadBandRange=0;
    	ch0->InputChan0=0;
    	ch0->InputChan1=0;
    	ch0->OutputChan0=12; Configures output mode (Step/dir, Quadrature, open collector, or actively driven)
    	ch0->OutputChan1=0;
    	ch0->MasterAxis=-1;
    	ch0->LimitSwitchOptions=0x100;
    	ch0->LimitSwitchNegBit=0;
    	ch0->LimitSwitchPosBit=0;
    	ch0->SoftLimitPos=1e+09;
    	ch0->SoftLimitNeg=-1e+09;
    	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=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.000768788;
    	ch0->iir[2].B1=0.00153758;
    	ch0->iir[2].B2=0.000768788;
    	ch0->iir[2].A1=1.92076;
    	ch0->iir[2].A2=-0.923833;
    The lines in bold, are the keys ones. There are other options, like the limit switch options, soft limit, and backlash settings that can be used in open loop mode, but nearly everything else is servo tuning specific.
    I'm guessing several people will be wondering what Jerk is. Well it's a limit on how quickly acceleration can be applied, and is defined in units per second per second per second. Using a basic non-jerk limited trajectory planner, you end up with a sharp start to acceleration, and a sharp stop to acceleration. On a graph plot showing that velocity, you end up with sharp corners during velocity changes. What Jerk does is round those corners, so you get smoother motion.

    After the channel configuration data, you need to enable each channel/axis, which is a simple job using EnableAxis(n).

    As I'm using Leadshine drives which have a relatively long pulse setup time requirement, the FPGA line stretches the standard KFlop step pulse length to meet this requirement.

    Then we finally assign each channel to the relevant axis, using the DefineCoordSystem() function. It's simply in the order of X(0), Y(1), Z(2), and as we have to declare four axes, we simply set the unused A to -1. This function allows you to set whatever channel you want to any axis, and you can even change it on the fly, by simply running another program which redefines the coordinate system I.e for if you wanted to do something like change the spindle (which is not controlled by the coordinate system) to a A axis (which needs to be part of the coordinate system).
    There are 6 and 8 axis versions of this function, so you can use any combination of X,Y,Z,A,B,C,U and/or V axes.

    The final couple lines of code tell the KFlop there is a Konnect expansion board attached, and what address range to use for the Konnect inputs and outputs.

    And that is a breakdown of a basic KFlop init.c file.
    Off course, it's been expanded on, which I will try and cover in later posts.
    Avoiding the rubbish customer service from AluminiumWarehouse since July '13.

  6. The Following 3 Users Say Thank You to m_c For This Useful Post:


  7. #6
    Clive S's Avatar
    Lives in Marple Stockport, United Kingdom. Last Activity: 15 Hours Ago Forum Superstar, has done so much to help others, they deserve a medal. Has a total post count of 3,345. Received thanks 618 times, giving thanks to others 83 times. Made a monetary donation to the upkeep of the community. Is a beta tester for Machinists Network features.
    Things like this would be nice to copy out to a tutorial section for future reference as stickies
    ..Clive
    The more you know, The better you know, How little you know

  8. #7
    Not sure if this a good advert for Kflop or not.? Certainly not for the beginner.! But well written.
    Last edited by JAZZCNC; 12-02-2017 at 11:27 AM.

  9. #8
    m_c's Avatar
    Lives in East Lothian, United Kingdom. Last Activity: 9 Hours Ago Forum Superstar, has done so much to help others, they deserve a medal. Has a total post count of 2,964. Received thanks 368 times, giving thanks to others 8 times.
    Quote Originally Posted by JAZZCNC View Post
    Not sure if this a good advert for Kflop or not.? Certainly not for the beginner.! But well written.
    It's certainly not a simple bit of kit, however I have seen a few complete beginners manage to get some quite complex systems up and running, with not that much help. It's one of those things, that if you want to learn how to get it working, you will, and you could say the same about most controllers if you've got no experience.

    Saying that, this is one part of setting up that would really benefit from a video showing the actual process, as once you know the process, it's not that hard.
    There are a few Dynomotion videos showing specific parts, or for specific boards. The KStep Introduction video, from 3:55 onwards shows the software process - https://www.youtube.com/watch?v=pW-9fDLAn2s
    Avoiding the rubbish customer service from AluminiumWarehouse since July '13.

  10. #9
    Well, I use Kflop and I was a complete beginner, my only coding experience was with Arduino which operates on a kind of simplified version of C.

    I first found it daunting. But I will say this, you don't really need to know the C language to make it work, you just need to apply a bit of common sense and spend time reading forum posts and reading the instructions. I requires real determination and patience and I fear that a lot of people will give up, which is a shame because it's a fantastic controller card.It's by no means a plug and play card.

    My breakthrough was when a friend sent me a basic set up file for the three motors. Very basic, but enough to get the motors going. In fact, Kmotion already includes a simple configuration file that can be used. But it is a convoluted program, you have to go from one window to the other and then back again. For instance, if the axes are disabled due to an e-stop, you can't switch them back on from within the CNC program, you have to open another program to enable the axes back again. They should amalgamate the two main programs (KMotion and KMotionCNC) into one.

    But, like a lot of applications, suddenly it all starts to click and make sense, and it is not difficult to add some lines of code to the basic init file as you build up the system.

    There are quirks, for example, you don't upload to the drive, you download. To reverse motor direction you set up your Gain to -1....then most of the program settings are calculated in inches, although you can work in metric when it matters.

    It is a very powerful and very stable controller, but it could do with some simplification for the novice, without losing the ability of tweaking and adding once you gain the experience. I think most Kflop users have needed some help at the beginning either from the very helpful owner or from other kind users.

    As for Dean's comment, he is spot on, you need to put yourself on the side of the novice to understand that even the very detailed information in M_C's post is just too daunting and a lot of people will say, the hell with it, I want a controller that works first time without all that coding palaver!

    Edward

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Denford Triac - Help
    By mikeadams1985 in forum Denford Mills
    Replies: 1
    Last Post: 12-01-2017, 10:06 AM
  2. FOR SALE: Denford Triac CNC PC
    By ricey3 in forum Items For Sale
    Replies: 6
    Last Post: 10-01-2017, 01:39 PM
  3. Denford Triac VMC
    By fidia in forum Milling Machines, Builds & Conversions
    Replies: 6
    Last Post: 19-08-2016, 08:18 AM
  4. Help Denford triac p.c.
    By mikeulike in forum Denford Mills
    Replies: 3
    Last Post: 02-06-2015, 03:59 PM
  5. WANTED: Denford Triac
    By edwardsjc in forum Items Wanted
    Replies: 13
    Last Post: 20-08-2012, 08:17 AM

Bookmarks

Posting Permissions

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