Need Help! Automatic Tool Change C Code - Page 2


Page 2 of 3 FirstFirst 123 LastLast
Results 13 to 24 of 27

Thread: Automatic Tool Change C Code

  1. #13
    Gold Member TomKerekes's Avatar
    Join Date
    May 2006
    Location
    USA
    Posts
    2518
    Downloads
    0
    Uploads
    0

    Default Re: Automatic Tool Change C Code

    Hi Dan,

    We can post any code to the wiki if you have problems doing it.

    The Tool Drop down is supposed to be an easy way to change tools. So that behavior is by design. I'm not sure I really understand the issue. What exactly are you expecting?

    Regards

    TK
    http://dynomotion.com


  2. #14
    Registered
    Join Date
    Feb 2008
    Location
    Canada
    Posts
    194
    Downloads
    0
    Uploads
    0

    Default Re: Automatic Tool Change C Code

    Quote Originally Posted by TomKerekes View Post
    Hi Dan,

    We can post any code to the wiki if you have problems doing it.

    The Tool Drop down is supposed to be an easy way to change tools. So that behavior is by design. I'm not sure I really understand the issue. What exactly are you expecting?

    Regards
    Next time I'm home I'll video the touch probe and send you the code to post. Email or here?

    My issue with the drop down chart is, just by opening the table to look at the tool database for offsets and data entry etc, when I leave that menu the machine automatically performs the tool change.

    What command is being sent? Is it an actual m6 g code command or something else?



  3. #15
    Registered
    Join Date
    Feb 2008
    Location
    Canada
    Posts
    194
    Downloads
    0
    Uploads
    0

    Default Re: Automatic Tool Change C Code

    Quote Originally Posted by TomKerekes View Post
    Hi Dan,

    We can post any code to the wiki if you have problems doing it.

    The Tool Drop down is supposed to be an easy way to change tools. So that behavior is by design. I'm not sure I really understand the issue. What exactly are you expecting?

    Regards
    Next time I'm home I'll record the touch probe and send you the code to post. Email or here?

    My issue with the drop down chart auto tool changing is, just by opening the table to look at the tool database for offsets and data entry etc, when I leave that menu the machine automatically performs the tool change. Sliding the tool tray into the work area.

    What command is being sent? Is it an actual m6 g code command or something else?



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

    Default Re: Automatic Tool Change C Code

    Hi Dan,

    Next time I'm home I'll record the touch probe and send you the code to post. Email or here?
    That would be great either way. But if you post here attach the C files as .txt files don't paste them into the message or the formatting will be lost.

    My issue with the drop down chart auto tool changing is, just by opening the table to look at the tool database for offsets and data entry etc, when I leave that menu the machine automatically performs the tool change. Sliding the tool tray into the work area.
    Selecting a Tool from the drop down should perform a tool change. But opening the Tool Table to edit or view it should not. Are you sure that is the case? I just tested and don't see that. What Version of KMotion are you running?

    Regards

    TK
    http://dynomotion.com


  5. #17
    Registered
    Join Date
    Feb 2008
    Location
    Canada
    Posts
    194
    Downloads
    0
    Uploads
    0

    Default Re: Automatic Tool Change C Code

    Quote Originally Posted by TomKerekes View Post

    Selecting a Tool from the drop down should perform a tool change. But opening the Tool Table to edit or view it should not. Are you sure that is the case? I just tested and don't see that. What Version of KMotion are you running?

    Regards
    This was the case I recall happening, even if there wasn't a change in tool selection when I clicked away form the menu (anywhere on the screen) causing it drop down list to close, the machine would read a tool change command and execute it even if there was change in tool selection.

    i.e. if Tool 6 was in the spindle, Tool 6 would be dropped off and picked back up again.

    We are running 4.34H



  6. #18
    Registered
    Join Date
    May 2012
    Location
    canada
    Posts
    192
    Downloads
    0
    Uploads
    0

    Default Re: Automatic Tool Change C Code

    Quote Originally Posted by slimneill View Post
    This was the case I recall happening, even if there wasn't a change in tool selection when I clicked away form the menu (anywhere on the screen) causing it drop down list to close, the machine would read a tool change command and execute it even if there was change in tool selection.

    i.e. if Tool 6 was in the spindle, Tool 6 would be dropped off and picked back up again.

    We are running 4.34H
    My machine changes only when you use the drop down list. No action when you open tool table. Also you should add a check to your toolchange program for requested tool and current tool being equal and end the program. No need to actually do a tool change when the current tool is loaded.



  7. #19
    Registered
    Join Date
    Feb 2008
    Location
    Canada
    Posts
    194
    Downloads
    0
    Uploads
    0

    Default Re: Automatic Tool Change C Code

    Quote Originally Posted by mmurray70 View Post
    My machine changes only when you use the drop down list. No action when you open tool table. Also you should add a check to your toolchange program for requested tool and current tool being equal and end the program. No need to actually do a tool change when the current tool is loaded.
    Which spindle are you using? I'm curious as to how you verify that it isn't rotating?

    My HSD spindle has a signal that is on/off for 180deg rotation while operating the signal looks like it's on full time but there is a 50% chance that you will get a high signal even when the spindle isn't moving.

    My VFD (HITACHI) has an output signal which goes high when zero RPM is achieved which is what I'm using.



  8. #20
    Registered
    Join Date
    May 2012
    Location
    canada
    Posts
    192
    Downloads
    0
    Uploads
    0

    Default Re: Automatic Tool Change C Code

    Quote Originally Posted by slimneill View Post
    Which spindle are you using? I'm curious as to how you verify that it isn't rotating?

    My HSD spindle has a signal that is on/off for 180deg rotation while operating the signal looks like it's on full time but there is a 50% chance that you will get a high signal even when the spindle isn't moving.

    My VFD (HITACHI) has an output signal which goes high when zero RPM is achieved which is what I'm using.
    My toolchange program checks if the spindle is running (just reads the CW and CCW bits) and if it is, it turns it off and waits 3 seconds for it to stop. It then orientates, and waits for orientation signal before actually changing the tool.

    You would probably be safe enough to just check if its on, tell it to stop, wait and then toolchange. Make sure your not using any manual switches or anything that could leave spindle on. If you want to be extra sure maybe you could get it to read that sensor and make sure the state isnt changing for a second or so.



  9. #21
    Registered endurance_robots's Avatar
    Join Date
    Mar 2017
    Location
    Moscow
    Posts
    64
    Downloads
    0
    Uploads
    0

    Default

    some software http://endurancerobots.com/download-center-lasers/ for creating gcode



  10. #22
    Registered
    Join Date
    Feb 2008
    Location
    Canada
    Posts
    194
    Downloads
    0
    Uploads
    0

    Default Re: Automatic Tool Change C Code

    Hi Tom,

    I've cleaned up the tool change and it's about 95% where I want it to be but fully functional for now. It's gotten more complicated since the last video now that the tools travel down alleys between holders so that they don't run into each other when going to the back row

    My issue is that I can't get a watch dog to work to prevent or bail on a tool change if the spindle gets turned on. I have an input from the VFD IO 1046 which goes Low when ever the VFD turns on the spindle.

    I've tried watch dog in different parts of the main file and it seems to hang up in the watch dog loop and not complete the tool change. Is there a better way to have the watch dog only active during the tool changing sequence and then turn off once complete?

    Current Code attached...
    Thanks,
    Dan

    Attached Files Attached Files


  11. #23
    Gold Member TomKerekes's Avatar
    Join Date
    May 2006
    Location
    USA
    Posts
    2518
    Downloads
    0
    Uploads
    0

    Default Re: Automatic Tool Change C Code

    Hi Dan,

    I don't fully understand your requirement. It seems you want to monitor IO 1046 and if it ever goes low during the Tool Change Sequence to abort the Tool Change Sequence? Wouldn't it be better to somehow prevent the Spindle from being turned on during the Tool Change Sequence?

    But to do the former I think you would need to "sprinkle" in tests throughout the code to check for IO Bit 1046 and if low return an error code. You would only need the check in places that wait for something to happen (sections of code that execute instantly would require any checks). So mainly time delays and wait while loops. You might create a new function int DelayAndCheckAllOK(double delay) that you could call instead of Delay_sec that would include the check (and possibly others) and return an error code if the spindle turned on.

    You could add a check right at the beginning to prevent anything from happening if the IO Bit is already low.

    HTH
    Regards

    TK
    http://dynomotion.com


  12. #24
    Registered
    Join Date
    Feb 2008
    Location
    Canada
    Posts
    194
    Downloads
    0
    Uploads
    0

    Default Re: Automatic Tool Change C Code

    Thanks Tom,

    My understanding of how the Watchdog worked was wrong. I thought it worked in the background or in parallel instead of in series with the rest of the C code in the Main program.

    My fix was to have the Tool Change code check that the spindle was turned off before starting. (i.e. Verify that IO 1046 is high). Then flag an Output IO high for the duration of the tool change.

    I then updated my C-code for spindle CW On command to look for the status of the new flag IO and abort the any attempted SPINDLE ON command if it finds itís state to be high. (Which only occurs during tool changes) The flag then turns off at the end of the tool change.

    Iíve tested this at every step of the tool change code by trying to turn on the spindle with the on screen spindle button and it just completes whatever line of Tool change code itís executing at the time and then stops all motion & activity. Which is safer than having the spindle turn on!

    Perhaps you can help me understand how Kflop handles multiple C code routines at once? I thought it was handle multiple routines in parallel based on which thread the code is loaded in. So I would have assumed that it would continue the tool change routine regardless of pressing the Spindle on command if both C code programs are on separate Threads? (I think Iím using different threads but would have to double check that). But Iíve noticed that if Iím running a C code routine like Homing or Part Zeroing and I click certain buttons in KmotionCNC it hangs on what it was doing. Is this due to how Kmotion CNC ranks the priority of activities? Itís not a big deal, we just donít click anything during these routines, Iíd just like to understand better how itís working.

    Thanks,
    Dan



Page 2 of 3 FirstFirst 123 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

Automatic Tool Change C Code
Automatic Tool Change C Code