586,499 active members*
2,123 visitors online*
Register for free
Login
IndustryArena Forum > Machine Controllers Software and Solutions > Dynomotion/Kflop/Kanalog > M & S Code (Configure or Define), in Initialization File: How to do it?
Results 1 to 2 of 2
  1. #1
    Join Date
    Jul 2004
    Posts
    240

    M & S Code (Configure or Define), in Initialization File: How to do it?

    Greetings,

    I am building a new CNC Software, KFlop Inside, or at the heart of the system.

    The part I am working on now. Is the Spindle Analog Control, via PWM, on pin 44. Like used via the KStep. Except I am not using the KStep board, nor the KMotion software. I will be using my own interface board.

    My custom software loads the pwm-analog out... control file into the KFlop thread 2.

    In GCode, when you turn on the spindle, and give it a speed... M4 S1000 (fwd 1000rpm)... this works via the Tool Setup in the KMotionCNC. So I know the C file is working.
    _______________________________________________

    My software auto loads this C program into thread 2.

    I need to be able in my Init. file, at startup. To configure the MCodes, as to what they should do.
    As well, I need to tell the S command, what it is to do.
    _______________________________________________
    M4 SetBit 46 ClearBit 47
    M5 Setbit 47 ClearBit 46
    S1000 execute thread 2 when called. S 2 0 "no file specified"... it is already loaded in thread 2.

    So, how to load these setting via the Initialization program. Which is a C program... so should be able to do this? I hope?

    Thanks in advance for your help!
    Robot & Machine Design - BLUECNC4, GreenCNC3, RedCNC2L, SilverCNC2; CNC Software!
    www.truemachinedesign.com - - - - - - - - - - - - - www.truemachineautomation.com

  2. #2
    Join Date
    Jul 2004
    Posts
    240

    Re: M & S Code (Configure or Define), in Initialization File: How to do it?

    OK,

    After communicating with Tom, he reckomended that I could fill the, "built in Table", with the settings for the MCodes, and the S code, in KMotion is equal to M10, or 10 in the index of the table.

    So below is the C# code I used to test the functionality. I run a Initialization with these lines, when my software starts. This tell the MCodes and the S code what to do when encountered.

    Note: KM here is short for the KMotion_Controller.

    KM.CoordMotion.Interpreter.SetMcodeAction(10, MCODE_TYPE.M_Action_Program, 2, 1, 0, 0, 0, "C:\\KMotion430\\C Programs\\KStep\\KMotionCNC\\Spindle_S_Kstep.c");
    KM.CoordMotion.Interpreter.SetMcodeAction(4, MCODE_TYPE.M_Action_SetTwoBits, 46, 1, 47, 0, 0, ""); //46 on 47 off?
    KM.CoordMotion.Interpreter.SetMcodeAction(5, MCODE_TYPE.M_Action_SetTwoBits, 46, 0, 47, 1, 0, ""); //46 off 47 on?

    This works for the test, to turn off and on the LED lights on the KFlop Board. Later they will be set to match the control of the Spindle Forward and Reverse.
    The file that is loaded for the Spindle PWM to Analog control... for Spindle Speed. Is loaded by the S command.

    I am very satisfied with the results... this should be good.

    Thanks for reading...
    Robot & Machine Design - BLUECNC4, GreenCNC3, RedCNC2L, SilverCNC2; CNC Software!
    www.truemachinedesign.com - - - - - - - - - - - - - www.truemachineautomation.com

Similar Threads

  1. Estop Watchdog command in Initialization File
    By slimneill in forum Dynomotion/Kflop/Kanalog
    Replies: 12
    Last Post: 12-29-2014, 10:58 PM
  2. MFG to NC/G-code file???
    By pzzamakr1980 in forum PTC Pro/Manufacture
    Replies: 3
    Last Post: 05-20-2010, 06:54 PM
  3. Need G-code file
    By nowforge in forum Employment Opportunity
    Replies: 2
    Last Post: 04-29-2010, 07:59 PM
  4. Replies: 3
    Last Post: 04-28-2010, 09:32 PM
  5. Need Help, BobCad/Cam G-Code file
    By Brushy Bill in forum Machine Created Art
    Replies: 1
    Last Post: 06-21-2007, 08:55 PM

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
  •