Page 4 of 6
Re: Rack ATC Macro Help
Posted: Sat Jan 18, 2020 7:28 pm
by hebs
Chris has used parameter 700 (a free user parameter) to store the current tool bin location so that the macro and main program can share its value (bin location of current tool). This is so that the code written for the carousel ATC can enable us to do what we want with a rack ATC - it keeps the existing program and macro in sync. The line he wrote to be put in the main.src file (don’t forget to compile it!) makes this possible.
The M18 macro file exists for ATC initialisation only. When you use it for the first time or need to reset after an error during tool change then the M18 macro resets parameter 700 to 1, telling the program that the tool in the spindle is tool 1 and to put it back in bin 1. Once you have done that then you can setup your tool library as you wish.
Re: Rack ATC Macro Help
Posted: Sat Jan 18, 2020 8:10 pm
by cbb1962
hebs, I was wondering if it makes sense to move your error checking to another macro and call that macro from the M6?
Re: Rack ATC Macro Help
Posted: Sun Jan 19, 2020 3:45 am
by hebs
When parameter 160 is set to 1, it triggers the enhanced ATC functionality including all the good bits we need to allow us to edit bin locations, unfortunately it also does all the error handling before the M6 macro, leaving very few error scenarios for any macro to handle afterwards. I don’t think that it will be possible to edit bins ‘on-the-fly’ - if there is an error with the library it just highlights this pre-macro and then stops the process without starting the macro.
I think I remember reading something about another parameter that allows you to do something different on an M6 call..... I’ll have a look.
edit...
Ok, I think that it may be possible using a M17 command and macro. I could edit my post processor to give a M17 command prior to a tool change (triggering a M17 macro that contains all the useful library checks prior to calling M6). The centroid manual also shows that if parameter 162 is set to 1 then intercon will also call M17 pre tool change. I need to check if pressing the F7 key for ATC tool change will also trigger M17... if so then great, this should work perfect.
Re: Rack ATC Macro Help
Posted: Sun Jan 19, 2020 3:35 pm
by cncsnw
No, the F7/ATC key will not call M17 (or any other code specified with P162).
The purpose of P162 and M17 is to save some time, when a cut has just been completed (tool is still down at clearance, spindle and coolant are still running), and a tool change is coming up. If you go straight into M6, CNC12 will move the head up to the tool-change level (G28 Z) before it runs any of the codes in the M6 macro. Executing an M code (e.g. M17) while still down there gives you a chance to turn off the coolant and start the spindle-orient process.
Since the F7/ATC key is generally used in setup operations and not in production, there is no reason to look up and run whatever M function might be specified in P162.
Re: Rack ATC Macro Help
Posted: Mon Jan 20, 2020 12:02 pm
by Allin1Chris
hebs wrote: ↑Sat Jan 18, 2020 9:47 am
Is it possible for me to catch this pre mfunc6.mac? or is the code relating to parameter 160=1 (containing library check etc..) built in to the main program?
This is handled in the software, depending on parameter settings the software handles it differently.
cbb1962 wrote: ↑Sat Jan 18, 2020 1:17 pm
If I understand this correctly this line G10 P700 R1 will Set parameter 700 to a value of 1. Why Parameter 700? shouldn't it be parameter 17000?
As Hebs explained, parameter 700 is required, as the tool that is put back is assigned its bin by the variable SV_PLC_CAROUSEL_POSITION in the PLC before or as the m6 is being ran. Otherwise the bin will remain 0 in the tool library for that tool.
Re: Rack ATC Macro Help
Posted: Mon Jan 20, 2020 12:22 pm
by cbb1962
Allin1Chris,
Thanks for the reply. I have modified and compiled the PLC changes and I have a finger version of your M6 working!
I was wondering if you had looked at the error checking that hebs has in his macro? The ability to manage the bin locations and keep them in sync with the real world is very appealing. With that said should, the hundreds of lines of code for error checking make if difficult to follow the macro. Does it make sense to create a macro that just does tool library error checking/maintenance and call that from within the M6?
Chris, since you deal with macros every day, how would you approach what hebs is trying to accomplish?
Re: Rack ATC Macro Help
Posted: Tue Jan 21, 2020 5:05 pm
by Allin1Chris
cbb1962 wrote: ↑Mon Jan 20, 2020 12:22 pm
I was wondering if you had looked at the error checking that hebs has in his macro? The ability to manage the bin locations and keep them in sync with the real world is very appealing. With that said should, the hundreds of lines of code for error checking make if difficult to follow the macro. Does it make sense to create a macro that just does tool library error checking/maintenance and call that from within the M6?
Chris, since you deal with macros every day, how would you approach what hebs is trying to accomplish?
For a non-random system, the bins for each tool should not change (i.e. Tool 1 should always go to the same bin). This changes for random tool changers for example like a swingarm where it will swap two tools, so tool that was in the spindle is now in the bin of the requested tool, so in this case the tool is always changing bins. The software when the PLC and macro are written properly will keep track where each tool is.
I think a macro that would highlight potential issues with their library could be useful, especially to those who may be new to CNC or just not familiar with ATC systems. As for an approach, i think hebs approach is good even though it may be as he described "hacky". The only thing i would do is change it to use the actual bin variables 17000 series instead of the diameter numbers 13000 series. The approach i took in my ATC macro available in this thread was to simply disallowed the macro to continue with a tool change if the putback bin was equal to the bin of the requested tool, preventing a crash.
As with most things, there is always room for improvement with the macros.
Re: Rack ATC Macro Help
Posted: Thu Jan 23, 2020 9:26 am
by hebs
I am working on a library checking macro now. I have learned a great deal from Chris’s macros (thanks Chris!) and can write this correctly now (or less inefficiently than the last one).
It may be misusing the M17 macro, but this is what I intent to use to capture a check before the centroid software runs its own check outside of any macro.
Re: Rack ATC Macro Help
Posted: Sun Feb 02, 2020 6:19 pm
by cbb1962
Any luck hebs?
Re: Rack ATC Macro Help
Posted: Tue Feb 04, 2020 6:44 pm
by hebs
Not yet, sorry. Have been tied up with work. I will hopefully get time this weekend.