Hello Guest it is March 28, 2024, 09:25:27 AM

Author Topic: Doubts about M6 macro  (Read 2824 times)

0 Members and 1 Guest are viewing this topic.

Doubts about M6 macro
« on: October 04, 2017, 07:43:45 AM »
Hello guys, it's my first post around here. I have some questions concerning the M6 macro and i'll be pointing them below:

1) When the M6 macro finishes, let's say my custom M6 finishes in a safe Z position, it will automatically return to the original position it left on my part to make the change ?

And this command here plays what part in the code to return to the original position?
Code: [Select]
x = GetToolChangeStart(0) 'X igual a 0
y = GetToolChangeStart(1) 'Y igual a 0
z = GetToolChangeStart(2) 'Z igual a 0
a = GetToolChangeStart(3) 'A igual a 0


2) When the M6 is called, the cycle that i am running stops ? If it does, i need to write something to call for a cycle start in the end of the M6 custom macro or it will automatically resume the part ?

3) In my custom M6 i am using an OUTPUT of my BREAKOUT BOARD to let the program know if there is a tool loaded already in the SPINDLE, but i see some flaws that i would like to point:

- To activate the OUTPUT,  the function that loads the tool in M6 macro needs to be run a first time
DOWNSIDE: If there is already a tool in the spindle, it will end crashing. Likewise, if i accidentally turn off the machine, i will need to remove the tool..

Why the machine needs to load the first tool? Because i have a mechanical unloader/loader, so some positions/tightening torque needs to be in "phase", so the arm will take care of both unload and load.

So i am wondering, is there a way to mark deep down in mach memory, in a variable or anything else that a tool has already been loaded?

To that solution there is already a flaw, if with the machine off i remove the tool from the spindle, it will think there is a tool there, BUT it will try to unload a non existing tool so it won't crash (SAFER)

So there is a way ?


4) Let's say i have the following structure:

Code: [Select]
Sub Main()

Dim NewTool As Integer
Dim OldTool As Integer

        OldTool = GetOEMDRO(1200)
NewTool = GetSelectedTool()

If NewTool = OldTool Then
Exit Sub
End If

If IsActive(OUTPUT1) Then
Call Unload_Tool
Else
Call Load_Tool
End If

End Sub

Function Unload_Tool()
End Function

Function Load_Tool()
End Function

I presume it will work like this:
- It will check first if the tool CALLED is equal to the tool IN USE.
- If it is, then it will exit the M6 macro.

Or it will work like this:
-  It will check first if the tool CALLED is equal to the tool IN USE.
-  If it is, it will exit the MAIN SUB and push forward the macro calling one function after the other.

Which one ?






Re: Doubts about M6 macro
« Reply #1 on: October 07, 2017, 12:16:14 PM »
bump
Re: Doubts about M6 macro
« Reply #2 on: October 07, 2017, 08:16:49 PM »
Hi,
I've changed to Mach4 and was never very good at VB when I was still using Mach 3, however:
Code: [Select]
x = GetToolChangeStart(0) 'X igual a 0
y = GetToolChangeStart(1) 'Y igual a 0
z = GetToolChangeStart(2) 'Z igual a 0
a = GetToolChangeStart(3) 'A igual a 0

is the means that Mach recalls its last know position. Within Machs core there is a variable that stored the last X value prior to the toolchange
and GetToolChangeStart(0) is how you access it.

Not sure about question 2). I don't have an ATC so in my Gcode programs which have an m6 toolchange I wish the machine to halt UNTIL I
hit <cycle start>. Do you require the machine to resume automatically? If you do then program a cycle start... something like DoOEMButton(nnn)
which is equivalent to a button push and if nnn reflects the number of the Cycle Start button your good.

Question 3) I am confused, you say you are using an output...so Mach is sending a signal to your breakout board....and then activating what?
I think your terminology is confused, you should send a signal TO Mach with an input. Aside from the confusion of terms what can you tell me about
the signal. I have seen on professional spindles a contact that detects if a tool is in place. It is a mechanical switch and doesn't require Mach or any thing
else to be running for it to be read. Is the signal you've got like that? If it is your toolchange macro would just read the state of the input, ie whether
a tool is already in place and do one set of instructions if it has and do another set of instruction if it hasn't. The m6 macro shouldn't have to run for
the signal to be valid.

Not clued up enuf on VB to tell you how that last structure would work in practice.

Craig
'I enjoy sex at 73.....I live at 71 so its not too far to walk.'
Re: Doubts about M6 macro
« Reply #3 on: October 08, 2017, 01:38:29 PM »
About question 3, i need something that transcends the M6 script. The variables in the program are not global relative to mach, the output of my bob is. I won't activate any mechanical switch or inductive to mark a tool in the spindle. It's just something that transcends the m6 script local variables. But the problem is that it doesnt transcends the machine on/off state.

I tested the question about hitting cycle start. Yes i wrote DoOEMButton(1000) and it works like a charm. It worked on a G-CODE program.
Re: Doubts about M6 macro
« Reply #4 on: October 09, 2017, 12:15:37 AM »
Hi,
can't quite see the purpose of the signal unless it actually reflects whether a tool is in place or not. Additionally if the signal is not valid until
the macro has been run once and yet you could crash your machine if you assume no tool is in place when in fact there is.

I reminds me of a cartoon character who was happily sawing a branch that he was sitting on....but he was outward of the cut!

I take it that your spindle is not equipped with a 'tool in place' switch? How about your carousel? If there were a proximity switch on each of the
tool recepticals and one was missing, it must be in the spindle. If all proximity switches are active then all the toolholders are in the carousel
ergo there can't be one in the spindle.

Craig
'I enjoy sex at 73.....I live at 71 so its not too far to walk.'
Re: Doubts about M6 macro
« Reply #5 on: October 14, 2017, 12:35:42 PM »
It's for the sake of simplicity. I can't put a switch indicating that there is a tool loaded