starting my C program, any guidance would be appreciated.


Page 1 of 10 1234 ... LastLast
Results 1 to 20 of 197

Thread: starting my C program, any guidance would be appreciated.

  1. #1
    Member Gunmachinist's Avatar
    Join Date
    May 2020
    Posts
    224
    Downloads
    0
    Uploads
    0

    Default starting my C program, any guidance would be appreciated.

    I have my initialization C program, after tuning the servos, for my axis done. Is defining each of the I/O all I need to in order to run G code?

    Similar Threads:


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

    Default re: starting my C program, any guidance would be appreciated.

    Hi Gunmachinist,

    I'm not sure what you mean by: "defining each of the I/O"

    It depends on what devices you have in your system and how are they controlled.

    Normally to run KMotionCNC you would assign a User INIT button to the initialization C Program.

    Then configure all your MCodes.

    Then configure all of the Trajectory Planner Settings. See here and here.

    HTH

    Regards
    TK http://dynomotion.com


  3. #3
    Member Gunmachinist's Avatar
    Join Date
    May 2020
    Posts
    224
    Downloads
    0
    Uploads
    0

    Default re: starting my C program, any guidance would be appreciated.

    Thinking I would need to add my limit switch I/O to my ini. C program for them to work.
    Like:
    int LimitSwitchNegBit; // Neg Limit I/O Bit number
    int LimitSwitchPosBit; // Pos Limit I/O Bit number



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

    Default re: starting my C program, any guidance would be appreciated.

    Configure them using the Configuration Screen as described here.

    The export to your C Program as described here.

    Regards
    TK http://dynomotion.com


  5. #5
    Member Gunmachinist's Avatar
    Join Date
    May 2020
    Posts
    224
    Downloads
    0
    Uploads
    0

    Default re: starting my C program, any guidance would be appreciated.

    I have been working with KMotionCNC in the Tool Setup Screen (M0 - M30). I've been able to get the spendle working CW/CCW/stop but am having trouble with how to get my axis working while running g code. My init. C program was done but the axis and most g-code telling the axis to m ove will not work, what am I missing?



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

    Default re: starting my C program, any guidance would be appreciated.

    How have you configured M0-M30 ?

    What is the GCode that doesn't work?

    Post your Init Program.

    Regards
    TK http://dynomotion.com


  7. #7
    Member Gunmachinist's Avatar
    Join Date
    May 2020
    Posts
    224
    Downloads
    0
    Uploads
    0

    Default re: starting my C program, any guidance would be appreciated.

    just started attempting to get this mill working but, here is a few screen shots of what I have at this point. I don't understand what the key box is on the User Button page. I know I need to create some C code for the rest of the M codes, or is there a place I can locate existing c code for them?

    Attached Thumbnails Attached Thumbnails starting my C program, any guidance would be appreciated.-screenshot-36-jpg   starting my C program, any guidance would be appreciated.-screenshot-37-jpg   starting my C program, any guidance would be appreciated.-screenshot-38-jpg   starting my C program, any guidance would be appreciated.-screenshot-39-jpg  



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

    Default re: starting my C program, any guidance would be appreciated.

    The Key box is for specifying a keyboard shortcut key for the button. See here.

    It seems your INIT C Program isn't enabling the axes. Is it? See here.

    Nothing is configured for the S Action. Do you want to use it to control the Spindle Speed? See here.

    Regards
    TK http://dynomotion.com


  9. #9
    Member Gunmachinist's Avatar
    Join Date
    May 2020
    Posts
    224
    Downloads
    0
    Uploads
    0

    Default re: starting my C program, any guidance would be appreciated.

    here is my init file. I'm also having a problem with my limit switch, when they are active my axis will not move unless I manually press the switch.

    Attached Files Attached Files


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

    Default re: starting my C program, any guidance would be appreciated.

    You can change the polarity of limit switches by changing the "Stop when Low" Limit Switch Option as described here.

    Regards
    TK http://dynomotion.com


  11. #11
    Member Gunmachinist's Avatar
    Join Date
    May 2020
    Posts
    224
    Downloads
    0
    Uploads
    0

    Default re: starting my C program, any guidance would be appreciated.

    Quote Originally Posted by TomKerekes View Post
    It seems your INIT C Program isn't enabling the axes. Is it? See here.
    int -EnableAxis(0);
    int -EnableAxis(1);
    int -EnableAxis(2);

    int -EnableAxisDest(Z,0);
    int -EnableAxisDest(Y,1);
    int -EnableAxisDest(X,2);

    DefineCoordSystem(0,1,2,-1);

    Not sure how to get it to work, is this headed in the correct direction? If not then how?



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

    Default re: starting my C program, any guidance would be appreciated.

    No that's wrong. The code you posted after I asked was correct. Does it enable the axes?

    Regards
    TK http://dynomotion.com


  13. #13
    Member Gunmachinist's Avatar
    Join Date
    May 2020
    Posts
    224
    Downloads
    0
    Uploads
    0

    Default re: starting my C program, any guidance would be appreciated.

    Quote Originally Posted by TomKerekes View Post
    No that's wrong. The code you posted after I asked was correct. Does it enable the axes?
    No. It does not and keeps giving me the error pop up I posted in the screen shot.



  14. #14
    Member Gunmachinist's Avatar
    Join Date
    May 2020
    Posts
    224
    Downloads
    0
    Uploads
    0

    Default re: starting my C program, any guidance would be appreciated.

    I have gotten the X and Y axis moving, but when the X axis moves it counts in the screen Z axis. X axis will count like its moving but nothing moves. How do I correct the X axis to make it the X axis?



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

    Default re: starting my C program, any guidance would be appreciated.

    Which axes in KFLOP are your X and Z axes?

    Regards
    TK http://dynomotion.com


  16. #16
    Member Gunmachinist's Avatar
    Join Date
    May 2020
    Posts
    224
    Downloads
    0
    Uploads
    0

    Default re: starting my C program, any guidance would be appreciated.

    This what you mean:
    0=Z
    1=Y
    2=Z



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

    Default re: starting my C program, any guidance would be appreciated.

    Is that a typo?

    Regards
    TK http://dynomotion.com


  18. #18
    Member Gunmachinist's Avatar
    Join Date
    May 2020
    Posts
    224
    Downloads
    0
    Uploads
    0

    Default re: starting my C program, any guidance would be appreciated.

    Quote Originally Posted by TomKerekes View Post
    Is that a typo?
    Thats where the axis are connected in Kanalog, which is where I have everything connected. Maybe I missed a step where I specified that 0=Z, and 2=X ang just got lucky with Y=1?



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

    Default re: starting my C program, any guidance would be appreciated.

    So you did make a mistake in the previous post? Then code:

    DefineCoordSystem(2,1,0,-1); // define XYZA axes

    instead of

    DefineCoordSystem(0,1,2,-1);

    Regards
    TK http://dynomotion.com


  20. #20
    Member Gunmachinist's Avatar
    Join Date
    May 2020
    Posts
    224
    Downloads
    0
    Uploads
    0

    Default re: starting my C program, any guidance would be appreciated.

    Quote Originally Posted by TomKerekes View Post
    So you did make a mistake in the previous post? Then code:

    DefineCoordSystem(2,1,0,-1); // define XYZA axes

    instead of

    DefineCoordSystem(0,1,2,-1);
    That helped get X and Y working correctly, but Z still doesn work. I also tried [DefineCoordSystem(2,1,-1,0); // define XYZA axes] without success. How are the axis supposed to be defined normally?



Page 1 of 10 1234 ... LastLast

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

starting my C program, any guidance would be appreciated.

starting my C program, any guidance would be appreciated.

starting my C program, any guidance would be appreciated.