Machsupport Forum

Mach Discussion => General Mach Discussion => Topic started by: halkintool on January 06, 2009, 05:30:23 PM

Title: Assigning a port/pin to "torch up/torch down"
Post by: halkintool on January 06, 2009, 05:30:23 PM
I would like to use a digital output to control my preliminary torch height control. Im using an air cylinder to control my torch height and cant find any information on how i would assign a port/pin to that function. I can assign "coolant on/off" to that function and just add it to my G code, but im hoping theres a better way. Any help is appreciated.
Title: Re: Assigning a port/pin to "torch up/torch down"
Post by: Overloaded on January 06, 2009, 05:43:04 PM
How do you want to activate it ? Witha a manual button press or switch to toggle up-dn ? With GCode ?
Several ways to do it depending.......
Brain, Macro pump, Macro.........
RC
Title: Re: Assigning a port/pin to "torch up/torch down"
Post by: halkintool on January 06, 2009, 05:44:37 PM
I have an air solenoid. Solenoid normally open, torch is up. With voltage, closed and torch down. So all i need is a voltage to drop the tip when a cut starts.
Title: Re: Assigning a port/pin to "torch up/torch down"
Post by: Overloaded on January 06, 2009, 06:53:01 PM
Good info.....but not exactly what I meant to ask.
At what point does the cyl. go up or down ?
Is it during the program run...or do you do it manually ?
I dont have a plasma so I'm not sure how the "Preliminary Move" is meant to operate.
RC
Title: Re: Assigning a port/pin to "torch up/torch down"
Post by: halkintool on January 07, 2009, 10:42:24 AM
When you run a program, the torch turns on and off each time it cuts a shape from your plate. You want the torch to lower to each cut, then raise up and move to the next cut. So basically when the torch is off, you want it up, when the torch is on you want it down. But you want it to drop down a second before the torch comes on, and you want it to go up a second after it goes off. The function is to protect the torch tip from intersecting with parts you've cut that have shifted after being freed from your stock.  Right now i could manually add code throughout the G-code and assign "coolant on/off" to my height control, but that isnt ideal because i can't generate that into my code. 

If i could make the delay from "torch on" into movement, i could just use the torch on function. I just need to know how to assign a digital output to "torch on".
Title: Re: Assigning a port/pin to "torch up/torch down"
Post by: Overloaded on January 07, 2009, 11:55:22 AM
If you are using the M3 and M5 for ON and OFF, just modify those macros to include an activation and de-activation of an output to pull inand drop the relay.

Not sure of the syntax, but will try it later.
RC

Title: Re: Assigning a port/pin to "torch up/torch down"
Post by: Overloaded on January 07, 2009, 12:20:19 PM
Hmmmm. not sure why this is not working right.

If run through the script window, it's fine.
MDI M3 and the spindle starts imediately.

Hmmmmm, prety sure this would work in earlier revs.  ::)

RC  ???

BOTH of these work through the scripter window, but w/MDI, OUT3 never comes ON and the Spin. starts and stops immediately.
Otherwise  ::)  ::) I think it is what you are looking for.

I need a Code Monkey,
RC
Title: Re: Assigning a port/pin to "torch up/torch down"
Post by: halkintool on January 07, 2009, 12:55:24 PM
Hmmmm. not sure why this is not working right.

If run through the script window, it's fine.
MDI M3 and the spindle starts imediately.

Hmmmmm, prety sure this would work in earlier revs.  ::)

RC  ???

BOTH of these work through the scripter window, but w/MDI, OUT3 never comes ON and the Spin. starts and stops immediately.
Otherwise  ::)  ::) I think it is what you are looking for.

I need a Code Monkey,
RC

So what you have there "activate signal(output3)"

Would initial output 3 upon an M3 signal?  So you make the macro for M5 read "deactivate signal(output3)"?

Also, my output signal to my plasma unit will be "spindle on" and "off"?
Title: Re: Assigning a port/pin to "torch up/torch down"
Post by: Overloaded on January 07, 2009, 01:05:47 PM
If I could get it to work, I would have explained better.
I used OUTPUT3 for the coil on your Air valve.
M3 is Start or Torch ON.
OUT3 is activated first lowering your cyl.
% seconds later, the torch comes on (5 so I could easily see it)
all is well until your code hits M5.
Then the torch goes OFF and *seconds later OUT3 de-activates raising the cyl.
The ports/Pins are the easy part, need this to work first.
Might be to do with new release.
RC
Title: Re: Assigning a port/pin to "torch up/torch down"
Post by: halkintool on January 07, 2009, 01:15:02 PM
Do you have a link for coding basics or something? I have no experience what-so-ever.

I assume "Code G4 P5" is a code to initiate a 5 second delay?
Title: Re: Assigning a port/pin to "torch up/torch down"
Post by: Overloaded on January 07, 2009, 01:20:22 PM
Yes..G4 is pause and the P word defines the duration in second or milliseconds (selected in gen. config.)
The G Code button on the Mach screen has a good description of the codes.

The VB is a whole nother beast. Some stuff about it on the WIKI (under SUPPORT at top of this page)
We should get som help on this soon.

Title: Re: Assigning a port/pin to "torch up/torch down"
Post by: halkintool on January 07, 2009, 01:23:54 PM
Thank you. I didnt understand that you could put G codes right into the script editor thought G4 was something else.
Title: Re: Assigning a port/pin to "torch up/torch down"
Post by: Hood on January 07, 2009, 01:28:16 PM
If you are just wanting an output to switch on or off with M3 and M5 there is no need to mess with the macros, just enable the spindle relay setting and tell it which Output you want to use.
Hood
Title: Re: Assigning a port/pin to "torch up/torch down"
Post by: halkintool on January 07, 2009, 01:29:49 PM
The spindle relay needs to initiate 2 functions though. First a signal to lower the torch, then to start the torch with a pause in between.
Title: Re: Assigning a port/pin to "torch up/torch down"
Post by: Hood on January 07, 2009, 01:36:41 PM
ah OK sorry, never read through the thread fully.
Hood
Title: Re: Assigning a port/pin to "torch up/torch down"
Post by: Overloaded on January 07, 2009, 01:44:26 PM
Hood, I thought this would be the simplest way......any Idea why it executes fine through the scripter but not MDI ?
Can you give an example of another way ?
Thanks

 
Title: Re: Assigning a port/pin to "torch up/torch down"
Post by: Hood on January 07, 2009, 01:49:46 PM
Should work RC, will give it a go and see what happens.
Hood
Title: Re: Assigning a port/pin to "torch up/torch down"
Post by: Hood on January 07, 2009, 02:15:34 PM
Sorry it took so long, the forum has been down for me, seems to happen every now and again.
Anyway I tried it in Turn and it works fine but thought I better try in Mill as I presumed thats what you would be having a problem with and it doesnt work for me either. Not sure why but have asked Brian if he can shed any light on it.
Hood
Title: Re: Assigning a port/pin to "torch up/torch down"
Post by: Hood on January 07, 2009, 02:48:10 PM
RC I cant even get it working through the VB Editor with Mill, can you? Cant even get a user macro to activate an output in Mill, something strange especially as it works fin in Turn for me, does the modified M3 macro  work in Turn for you?
Hood
Title: Re: Assigning a port/pin to "torch up/torch down"
Post by: Overloaded on January 07, 2009, 02:55:50 PM
Hood, I didn't try any in turn....will shortly.
Thought maybe this one would work but it dont either.
ALL run perfectly if run thru the editor in Mill though.
RC
Title: Re: Assigning a port/pin to "torch up/torch down"
Post by: Overloaded on January 07, 2009, 03:03:43 PM
Hood,
I get the same in Mill and Turn. Only runs from the editor.
I open 2 editor windows on the diag screen...m303 and m505
They run good from the editors.
Title: Re: Assigning a port/pin to "torch up/torch down"
Post by: Hood on January 07, 2009, 03:04:53 PM
What Rev of Mach are you using as I cant get it to work at all in Mill. I have R3.043.000
Hood
Title: Re: Assigning a port/pin to "torch up/torch down"
Post by: Overloaded on January 07, 2009, 03:11:49 PM
3.042.020
Title: Re: Assigning a port/pin to "torch up/torch down"
Post by: Hood on January 07, 2009, 03:38:06 PM
that may be the difference then, will try with an lder version.
Hood
Title: Re: Assigning a port/pin to "torch up/torch down"
Post by: Hood on January 07, 2009, 04:04:27 PM
Well just the same with an older version for me went to 42.018 and works fine in turn but not mill.
Hood
Title: Re: Assigning a port/pin to "torch up/torch down"
Post by: Overloaded on January 07, 2009, 04:13:20 PM
Strange.  I dont get it. I wrote one that didnt use the DoSpin....just a DElay then activate the input for the spindle relay. They all act the same way..ignoring the delays.
 
Oh yes...and I recall on Yahoo back about  020 to the last lock-down much talk about scripts but didn't delve into it.
Title: Re: Assigning a port/pin to "torch up/torch down"
Post by: Hood on January 07, 2009, 04:57:04 PM
RC put a few message boxes in your macro and see if you get the messages when you M3, that will let you know the macro is running, just its not working right ;)

To do that you just put these in your code
MsgBox("Its Running")

Hood
Title: Re: Assigning a port/pin to "torch up/torch down"
Post by: Hood on January 07, 2009, 05:09:31 PM
RC have a look see if you have a M3.mcc in the macro folder.
Hood
Title: Re: Assigning a port/pin to "torch up/torch down"
Post by: Hood on January 07, 2009, 05:37:51 PM
Well RC I have it working fine with OutPut 1 as the spinlde relay and OutPut3 as the one being switched on in the macro. If I use OutPut2 then I cant seem to get it to work but I cant even get the LED to light if I just call ActivateSignal(OutPut2) directly from the editor so maybe for some reason the LED is just not being lit. I dont have a PP in this computer so cant physically check it with a meter to see if the real output is switching.
Anyway I put this in the M3 to save me having to switch them off again and it works for me, as I said OP for spindle relay is set to 1.

ActivateSignal(Output3)
Code ("G4P5")
While IsMoving()
Wend
Sleep(10)
DoSpinCW()
MsgBox("It's Alive shame Brett isn't")

Code("G4P5")
While IsMoving()
Wend
sleep(10)
DeActivateSignal(Output3)
Code("G4P5")
While IsMoving()
Wend
sleep(10)
DoSpinStop()

See if that works for you
Hood
Title: Re: Assigning a port/pin to "torch up/torch down"
Post by: Overloaded on January 07, 2009, 05:43:53 PM
Hood, I think I found the problem here. I have macros in three places. Macros folder and in a sub called Mill macrosand another called Turn macros.
So there are 3 M3's, 2 of which are like the original.
Will sort them out shortly but that looks like the prob.
I see no .mcc files.
RC
Title: Re: Assigning a port/pin to "torch up/torch down"
Post by: Overloaded on January 07, 2009, 05:45:27 PM
Just saw your new post, will try later,  meeting time. Thanks
Title: Re: Assigning a port/pin to "torch up/torch down"
Post by: Hood on January 07, 2009, 05:47:59 PM
RC the Macro folder has folders in  it for each profile, the only one Mach will look at is for the profile you are using, so if for instantce you are using a profile call RCTurn.xml there will be a macro folder called that within the main macro folder and its the ones in the RCTurn that you need to alter.
Hood
Title: Re: Assigning a port/pin to "torch up/torch down"
Post by: Overloaded on January 07, 2009, 06:42:20 PM
Hood, What I had was several macros in the main macro folder along side the Profile folders. I'm guessing Mach was seeing those as well as the Profile macros. Cleaned it up and now it works perfectly now with these.
Live and Learn.

Your little ditty works fine too.....but the torch should go OFF before out3 raises it.
Thanks,
 RC
 
Title: Re: Assigning a port/pin to "torch up/torch down"
Post by: Hood on January 07, 2009, 06:59:16 PM
Yes RC, that wouldnt have worked for the guys setup, it was purely lazyness on my part whilst testing as it saved me altering two macros and I just wrote it to turn off the outputs with the M3 to save me typing M5 and resetting to turn off the other one.
As for the other macros, that shouldnt be the case as Mach should only look in the macro folder of  profile that you are running, if that was not the case I would be in real deep s*** as I have probably got 50 or more macro folders :D

 Can you do a test for me, see if you can switch OutPut2 on from a macro, I cant. Yet I can have a Brain do it no problem. As I siaad in turn it works fine and in Mill alll other outputs seem fine, just 2 thats not playing.
Hood
Title: Re: Assigning a port/pin to "torch up/torch down"
Post by: halkintool on January 07, 2009, 07:04:17 PM
I appreciate your help guys. I found out the air valve is junk so ill have to wire it to an LED to get it "working" for now.

Title: Re: Assigning a port/pin to "torch up/torch down"
Post by: Overloaded on January 07, 2009, 07:08:01 PM
Yes...2,3,and 4 work fine.......but not at first.  The outputs need to be enabled in P&P.
RC
Title: Re: Assigning a port/pin to "torch up/torch down"
Post by: Hood on January 07, 2009, 07:09:27 PM
yes mine are, weird lol

Hood
Title: Re: Assigning a port/pin to "torch up/torch down"
Post by: Overloaded on January 07, 2009, 07:12:16 PM
#2 might be too busy somewhere else to play ?
Title: Re: Assigning a port/pin to "torch up/torch down"
Post by: Hood on January 07, 2009, 07:18:30 PM
Well I dont know, maybe I just neek to kick it in the arse :)
Hood
Title: Re: Assigning a port/pin to "torch up/torch down"
Post by: Overloaded on January 07, 2009, 08:07:08 PM
Quote
As for the other macros, that shouldnt be the case as Mach should only look in the macro folder of  profile that you are running, if that was not the case I would be in real deep s*** as I have probably got 50 or more macro folders

I see now what I was doing wrong....wasn't looking closely enough at the folders I was in. Changed more s**t than I needed to !
All better now......Wheww.
RC
Title: Re: Assigning a port/pin to "torch up/torch down"
Post by: halkintool on January 08, 2009, 11:30:21 AM
I noticed you renamed the macros M303 and M505. Was your intension to run these as M303 and M505 codes? Or should i be modifying the M3 and M5 macros?
Title: Re: Assigning a port/pin to "torch up/torch down"
Post by: Overloaded on January 08, 2009, 11:35:06 AM
I just did that so I could experiment without changing anything original. 303 and 505 were not used so I made them up.
Now that I know it works, I would modify the M3 and M5.
RC
Title: Re: Assigning a port/pin to "torch up/torch down"
Post by: halkintool on January 08, 2009, 11:36:32 AM
Great, ill try this on the machine today, ill make a vid of the machine in action too.
Title: Re: Assigning a port/pin to "torch up/torch down"
Post by: Overloaded on January 08, 2009, 11:39:33 AM
That would be GREAT !
Hope it all works out good for you.
RC
Title: Re: Assigning a port/pin to "torch up/torch down"
Post by: halkintool on January 08, 2009, 11:44:16 AM
It seems like everything is good. I havent purchased the new plasma unit yet, so hopefully that doesnt cause too much interference was its up and running. Im running the optoisolation board and shielded cables so it should be good.  You guys have been a great help, i wouldnt have been able to get this running without you. My partner here that was helping me is on a service trip so i woulda been on my own without the forum. Thanks again.
Title: Re: Assigning a port/pin to "torch up/torch down"
Post by: Overloaded on January 08, 2009, 11:52:02 AM
No prob. I appreciate the challenge. I dont know much about it (as you can see) but find this is the best way to learn.
See Ya,
RC
Title: Re: Assigning a port/pin to "torch up/torch down"
Post by: halkintool on January 08, 2009, 03:25:09 PM
Heres a quick vid, i was using a paint marker to simulate a cutter this vid just follows a previous trial, kinda lame. But whatever. Machine is working pretty smooth, this vid was shot at 200IPM i believe.

(http://img.photobucket.com/albums/v133/black240sx/th_100_4763.jpg) (http://smg.photobucket.com/albums/v133/black240sx/?action=view&current=100_4763.flv)
Title: Re: Assigning a port/pin to "torch up/torch down"
Post by: Hood on January 08, 2009, 03:29:59 PM
Looking good :)
Hood