Machsupport Forum

Mach Discussion => General Mach Discussion => Topic started by: dec@rocketmail.com on December 12, 2012, 09:40:00 AM

Title: Help: M6 macro acts weird
Post by: dec@rocketmail.com on December 12, 2012, 09:40:00 AM
Hi all,

I am building an auto-tool changer for a Techno machine.  I have my relay box and solenoid array built and they work great.  Here's my snag:

I have added an "M8" to the beginning of my post processor, and "M9" at the end.  This operates a clamp that MUST remain on for the entirety of the routine.  And it does, unless I change tools.  If I run an M6 tool change, the clamp lets go temporarily, then re-engages.  This happens exactly when the drawbar (Output1) is deactivated, and the spindle picks up the new tool.  For some reason, it's deactivating output2 also.  Strangely, it re-activates almost immediately.....

The macro is attached.  Anyone have any ideas?

tx,

Declan

Title: Re: Help: M6 macro acts weird
Post by: Hood on December 12, 2012, 10:16:52 AM
What outputs have you told Mach the Coolant is?
Hood
Title: Re: Help: M6 macro acts weird
Post by: dec@rocketmail.com on December 12, 2012, 10:18:48 AM
I'm using m8 for the clamp and m7 for the ATC drawbar.
Title: Re: Help: M6 macro acts weird
Post by: dec@rocketmail.com on December 12, 2012, 10:19:32 AM
Sorry - mapped m8 to output 2, m7 to output 1.

Title: Re: Help: M6 macro acts weird
Post by: Hood on December 12, 2012, 10:25:33 AM
Ok, try setting M7 to Ouput 2 as well as I dont think you are using a M7 in your macro but you are using OutPut (1) so that may be causing probs.
Hood
Title: Re: Help: M6 macro acts weird
Post by: dec@rocketmail.com on December 12, 2012, 10:27:30 AM
Hey Hood -  Thanks for your help.  I'm a little confused:  I do want the drawbar (m7, Output 1) to be driven by the macro.  I don't want the clamp (m8, Output2) controlled by the macro. 

Title: Re: Help: M6 macro acts weird
Post by: Hood on December 12, 2012, 10:32:20 AM
Ok whichever way it is set both flood and mist to the same output and see if it helps. If not attach your xml and I will test it out when I get home later.
Hood
Title: Re: Help: M6 macro acts weird
Post by: dec@rocketmail.com on December 12, 2012, 11:07:58 AM
Again, just a little confused....   I want the two outputs to operate individually, so I don't understand why they should both be assigned to one output #.  Is that what you meant?

I will definitely send you the xml - Thanks so much for your help!!!

d
Title: Re: Help: M6 macro acts weird
Post by: Hood on December 12, 2012, 01:31:09 PM
You want the two outputs but you are only calling one via the coolant m codes (M7 or M8 not sure which now ;D )

Hood
Title: Re: Help: M6 macro acts weird
Post by: dec@rocketmail.com on December 12, 2012, 01:46:11 PM
AAhhhhh..... interesting.  I thought you could use them as two separate outputs.  I was struggling to understand how to activate/de-activate the outputs, and I thought M7 and M8 would be quick, easy options (as long as they're set as Output1, Output2 respectively). 

So is this where you tell me I have to write my own macro to use more than one output?  ;)
Title: Re: Help: M6 macro acts weird
Post by: Hood on December 12, 2012, 01:56:38 PM
You can use them as two separate outputs but if I am understanding correctly you are only using r M8 to activate one and you are using VB for the other.
I am kind of struggling to explain what I am trying to get at here and I am not sure which you are using, M7 or M8 but I dont think you are using both? Yes you want to use the two outputs but only one of them is to be called from M8 (or M7) yet you have both the relay options set up for these outputs.
Hood
Title: Re: Help: M6 macro acts weird
Post by: dec@rocketmail.com on December 12, 2012, 02:07:43 PM
lol - you're right:  my post-processor puts M8 (set to Output2 in Mach, which drives the air clamp) at the beginning of the code and M9 at the end.

The post also calls the M6 script when a tool change occurs.  This script doesn't actually contain an M7 nor M9 command, just ActivateSignal(Output1) and DeActivateSignal(Output1)

But, I guess that DeActivateSignal command is messing with Output2 somehow?

Again, thanks for your help.  I've been banging my head against this for a week!

dh
Title: Re: Help: M6 macro acts weird
Post by: Hood on December 12, 2012, 02:11:20 PM
It may be as you have that set up in Coolant relay section so Mach is thinking Output 1 is  for coolant.
If you attach your xml I will have a look and see what you have set up and maybe see if that is the problem or if its something else.

Hood
Title: Re: Help: M6 macro acts weird
Post by: dec@rocketmail.com on December 19, 2012, 11:39:38 AM
Hi Hood,

Attached is the xml I'm using.  I checked the outputs and it looks like I have Output1 = M7 and Output 2 = M8, so I'm still stumped.  Any help would be very much appreciated.

Thanks in advance!
Title: Re: Help: M6 macro acts weird
Post by: Hood on December 19, 2012, 01:19:50 PM
That seems to be a Post Processor rather than a Mach xml.
Hood
Title: Re: Help: M6 macro acts weird
Post by: dec@rocketmail.com on December 19, 2012, 01:48:08 PM
Doh - you're right, sorry.  here's the xml...  I'm also including the M6 macro.  There is a "M6Start" and "M6End".  Not sure what "end" does, but I suppose that might be handy to see....
Title: Re: Help: M6 macro acts weird
Post by: dec@rocketmail.com on December 19, 2012, 01:51:15 PM
I couldn't re-upload the m6 macro - it is posted previously in this thread...
Title: Re: Help: M6 macro acts weird
Post by: Hood on December 19, 2012, 03:02:42 PM
Ok try this, Config menu then Ports and Pins then Spindle Setup. Take the tick out of Disable Spindle Relays and change M3 to output 3 and M4 to Output 3 then tick the box again to disable the Spindle Relay.
See if that helps.
Hood
Title: Re: Help: M6 macro acts weird
Post by: dec@rocketmail.com on December 19, 2012, 03:25:35 PM
Nope, same thing.  The clamp lets go after the new tool is picked up - but the re-engages after 1 or 2 seconds.
Title: Re: Help: M6 macro acts weird
Post by: Hood on December 19, 2012, 03:30:47 PM
Did you restart Mach after you changed it? Not sure if it would be required but might be worth a go.
Other thing to try is what I suggested earlier,  try changing the M7 option in Spindle Relays to the same as the M8, ie have them both Output 2.

Hood
Title: Re: Help: M6 macro acts weird
Post by: dec@rocketmail.com on January 14, 2013, 09:49:01 AM
Ok - I'm finally back in the shop after a much-needed vacation, but this problem persists.  Please see the attached video (sorry it's sideways and blurry...) and see if this helps explain it any better. 

I'm going crazy over here!!!

tx,

dh
Title: Re: Help: M6 macro acts weird
Post by: Hood on January 14, 2013, 05:23:52 PM
Can you attach your latest xml and also the macro again, you will either need to zip them or rename before you attach as the forum only accepts a file name once.
Hood
Title: Re: Help: M6 macro acts weird
Post by: angel tech on January 14, 2013, 06:06:18 PM
this may be way off, but is the m9 cancelling both m8 and m7 as it would if it was commanding the coolant controls.
Title: Re: Help: M6 macro acts weird
Post by: BR549 on January 14, 2013, 06:15:02 PM
I can tell you form experience that it is NOT a good idea to use the M7/8/9  combo for anything other than than something like coollant or vac. They are tied into the matrix of the driver. Some in ways we have no idea that it is done that way.

I would suggest that you rethink your plans and use dedicated outputs mapped to dedicated pins and use seperate  Mcodes  to control them such as

M20 to close clamp
M21 to open clamp

M22 to activate air cylinder
M23 to deactivate Air cylinder

I think there are some industry standards for such I will look them up.

Just a thought,(;-)TP
Title: Re: Help: M6 macro acts weird
Post by: BR549 on January 14, 2013, 06:26:16 PM
Just a thought but what outputs are you using to control the spindle most use 1 and 2 I do know that if you have the M3 active and call a M6t6 mach3 will shut OFF the outputs for M3 M4.

Just a thought,(;-)
Title: Re: Help: M6 macro acts weird
Post by: dec@rocketmail.com on January 16, 2013, 05:52:09 PM
BR549 -

That's exactly what I'd like to do, but I don't know how.  I tried opening an .m1s script, changing the script to activate signal Output1,  and renamed it as m20.  But when I type m20 in the MDI, nothing happens.  Could you point me in the right direction?  Keep in mind that ultimately I would like to use m7 or m8 for a coolant spray. 

I will post my XML and script soon, but on top of this headache, my wireless card just died, so I'm typing this on my phone   >:(

Thanks again for everyone's help- these Internet forums are priceless!!!!

D
Title: Re: Help: M6 macro acts weird
Post by: Hood on January 16, 2013, 06:21:19 PM
Best to stick the M numbers over 100 as under that are meant to be reserved for Mach use.
Open a text file with notepad.
Type the following into it

ActivateSignal (OutPut1)

Save it as say m101.m1s to the macro folder of the profile you are using, eg if using the standard Mill profile the normal location would be
C:\Mach3\Macros\Mach3Mill

Once you have done that then it should work from MDI.
To turn it off you would have another macro with
DeActivateSignal(OutPut1)

and save that as a different m number, eg  m102.m1s



Hood

Title: Re: Help: M6 macro acts weird
Post by: BR549 on January 16, 2013, 06:40:01 PM
HIYA Hood , Just a thought but do you think we will ever have to worry about  getting anymore internal Mcodes for MACh3 ???  Same as worrying about Legacy VB functions calls like GetDro(0). OR getting Mach3Turn fixed ???

There are standard Mcodes for these features with other controller I always TRY to emulate standards IF possible. It is not always possible but I give it a whirl.

(;-)


Dec, First thing to figure out is DO you have enought output pins to do what you need. You are limited if you only use 1 lpt port. Best to add a second lpt for extra pins.

(;-) TP



Title: Re: Help: M6 macro acts weird
Post by: Hood on January 16, 2013, 06:47:41 PM
Maybe, maybe not but I would say best to stick to what should be safe ;)

Now standard, is there such a thing in CNC? ;D
 Hood
Title: Re: Help: M6 macro acts weird
Post by: Hood on January 16, 2013, 06:57:09 PM
Just as a wee side note, when I first did my lathe I used M10 and M11 for the chuck. Thats what the original control used and also what seems standard on many lathe controls for chuck open/close. I was advised by a few people it may be better to stick to above 100 for that. All depends on what Brian may do in the future, especially if Mach Rev4 will be more in keeping with Fanuc standards.
M20/21 seems to be more for orientation of the spindle or at least in some controls.
Hood
Title: Re: Help: M6 macro acts weird
Post by: Hood on January 16, 2013, 07:01:01 PM
Ha ha well I have just done a wee bit of searching for M Codes and Fanuc, there doesnt even seem to be a standard between them if what I am reading is correct, different versions have different M Codes  ;D
Hood
Title: Re: Help: M6 macro acts weird
Post by: dec@rocketmail.com on January 16, 2013, 07:10:38 PM
Hi guys,

Ok, we are getting there!!

I made the following macros:

M101 - ActivateSignal (Output1) Cyl on
M102 - DeActivateSignal (Output1) Cyl off
M103 - ActivateSignal (Output2) Clamp on
M104 - DeActivateSignal (Output2) Clamp off

They all work as expected in the MDI.  I went in to my post processor and put M103 at the beginning of the Program Start string (M103 G00 G49 G40.1 G17 G80 G50 G90 G64 G20).  Then put M104 at the very end of the program. 

In Mach3, I changed the flood and mist outputs to 3 and 4 respectively, then disabled them in the OutputSignals section, just to rule them out....

However, the M6 script still DeActivates Output2 despite there only being a command to DeActivate Output1.  Same problem as before...   :-\ 

Attached are my Mach3 xml and M6 macro....
Title: Re: Help: M6 macro acts weird
Post by: BR549 on January 16, 2013, 08:39:13 PM
I would look in the HAAS world as they are the upcoming defacto standards these days (;-) Nice screensets as well. Fairly easy navigation.   Fanuc is still stuck in the early 90s programming mode.

(;-) TP

Title: Re: Help: M6 macro acts weird
Post by: BR549 on January 16, 2013, 09:08:04 PM
You did not include the M6 macro.

What ouputs are you using for M3 M4?

What are you setting the tool change mode to Manual, auto ?

(;-) TP
Title: Re: Help: M6 macro acts weird
Post by: BR549 on January 16, 2013, 11:28:16 PM
You need to try moving the clamp and release to a new  pin on the port . This would help solve the problem. What ever pin you have mapped for output2 move it to another free ouput pin.

I have been looping it here for hours and have not seen it fail yet.

Just a thought, (;-) TP
Title: Re: Help: M6 macro acts weird
Post by: BR549 on January 16, 2013, 11:45:19 PM
ALSO you may want to try the routine from another macro outside of the M6 routine.

Create a new macro like this and see IF the output2 does the same thing

ActivateSignal(output2)       'activate clamp
Sleep(1000)                       'wait 1 sec
ActivateSignal(output1)       'Activate Cylinder
Sleep(1000)
DeactivateSignal(ouput1)     'Deactivate Cylinder
Sleep(3000)
DeactivateSignal(ouput2)        'Deactivate Clamp
End

(;-) TP
Title: Re: Help: M6 macro acts weird
Post by: Hood on January 17, 2013, 03:21:46 AM
Fanuc is still stuck in the early 90s programming mode.

(;-) TP


You reckon they are that up to date? ;D
Hood
Title: Re: Help: M6 macro acts weird
Post by: dec@rocketmail.com on January 21, 2013, 04:39:28 PM
Just a followup - cause I know you guys are staying awake at night wondering... ;)

I opened my relay BOB and watched the LED's on each relay.  I then ran M101 (activate Sig 1) and M103 (activate Sig 2).  Then M102 (DeActivate Sig 1) and I see that the RELAY for sig 2 remains active, but the clamp still releases.  This leads me to think the solenoids are wired incorrectly - which is entirely possible because I built this whole rig myself.  They share a common/ground, so maybe that's the issue (?).

So, now I'm diagnosing my solenoids.  Many thanks to everyone here.  If nothing else, I learned a lot about macros!

Cheers,

dh
Title: Re: Help: M6 macro acts weird
Post by: dec@rocketmail.com on January 24, 2013, 01:04:21 PM
SUCCESS!! 

By adding a commutating diode to each solenoid, I eliminated back-EMF pulses which were causing my problems. 

Again - thanks to everyone for chiming in.  Although it ended up not being a Mach issue, I never would've figured it out without your help!

dh
Title: Re: Help: M6 macro acts weird
Post by: Hood on January 24, 2013, 01:21:47 PM
Good to hear you have it sorted, was puzzling me.
Hood