Need Help! C code for button


Results 1 to 4 of 4

Thread: C code for button

  1. #1
    Member
    Join Date
    May 2017
    Location
    United States
    Posts
    82
    Downloads
    0
    Uploads
    0

    Default C code for button

    I am trying to do c code when adding a button. I want to add three buttons one to move x to 0 one to move y to 0 and one to move z to -.75. I tried the move command but when I move to my zero position and reset the zero then the move command to zero moves the amount i zeroed out not back to the new zero position. Tried other commands and get undeclared error messages.

    This should be easy i move axis to zero location with arrow buttons then press zero for all axis then after machine runs a program I want the user buttons to bring x and z back to zero. I use a .75 block to adjust z zero then move off the work piece and lower the z .75 and reset zero. I would like a button so I don't have to use the arrow buttons 12 times.

    Joe

    Similar Threads:


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

    Default Re: C code for button

    Hi Joe,

    I am trying to do c code when adding a button. I want to add three buttons one to move x to 0 one to move y to 0 and one to move z to -.75. I tried the move command but when I move to my zero position and reset the zero then the move command to zero moves the amount i zeroed out not back to the new zero position. Tried other commands and get undeclared error messages.
    To move to GCode Coordinates rather than Machine Coordinate zero you might use GCode instead of C Code. Create a GCode file (MoveToZero.ngc) something like this:

    G0Z-0.75
    G0X0Y0
    M30

    Then configure the User Button to run that GCode File with:

    C code for button-tozero-jpg


    I use a .75 block to adjust z zero then move off the work piece and lower the z .75 and reset zero. I would like a button so I don't have to use the arrow buttons 12 times.
    You shouldn't really need to move to zero to set the origin instead simply set the GCode position to 0.75. You could do that with GCode to set the G92 Offset similar to above with:

    G92Z.75
    M30

    If you want to also move to the new zero for some reason you could also do this with:

    G92Z.75
    G0X0
    M30


    HTH

    Regards
    TK http://dynomotion.com


  3. #3
    Member
    Join Date
    May 2017
    Location
    United States
    Posts
    82
    Downloads
    0
    Uploads
    0

    Default

    Quote Originally Posted by mirocha View Post
    I am trying to do c code when adding a button. I want to add three buttons one to move x to 0 one to move y to 0 and one to move z to -.75. I tried the move command but when I move to my zero position and reset the zero then the move command to zero moves the amount i zeroed out not back to the new zero position. Tried other commands and get undeclared error messages.

    This should be easy i move axis to zero location with arrow buttons then press zero for all axis then after machine runs a program I want the user buttons to bring x and z back to zero. I use a .75 block to adjust z zero then move off the work piece and lower the z .75 and reset zero. I would like a button so I don't have to use the arrow buttons 12 times.

    Joe
    Works great setup 4 buttons thanks
    Joe



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

    Default Re: C code for button

    Hi Joe,

    Great. Thanks for taking the time to post back

    Regards
    TK http://dynomotion.com


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

C code for button

C code for button