Hello Guest it is May 09, 2024, 10:26:04 PM

Author Topic: Macro Controlling Multiple Outputs  (Read 5257 times)

0 Members and 1 Guest are viewing this topic.

Macro Controlling Multiple Outputs
« on: November 11, 2006, 04:16:10 AM »
Hi, I'm new to this forum, but I have been a Mach user for 2 years, just that I didn't really  play with macros. I'm setting up a oxy control, which control valves of oxy. and acet., to suit the traditional cutting style. As you can see, there are ignition delay, preheat delay and pierce delay, and 3 of them are controlled by 3 different outputs. The problem i'm facing is everytime i trigger this macro script, all the outputs triggers at the same time. I cant get it to delay before triggering another output. Can someone kindly help to neaten up the script? Thanks!

rem  M3 Macro
Dim IgnitionDelay, PreheatDelay, PierceDelay
IgnitionDelay = getUserDRO (1001)
PreheatDelay = getUserDRO (1002)
PierceDelay = getUserDRO (1003)

ActivateSignal(Output1)
code "G4 P" & (IgnitionDelay)

ActivateSignal(Output2)
code "G4 P" & (PreheatDelay)

ActivateSignal(Output3)
code "G4 P" & (PierceDelay)
End
Re: Macro Controlling Multiple Outputs
« Reply #1 on: November 11, 2006, 09:09:19 AM »
This is what I like to see :) you tried and all I have to do is a little work to the script! You get a star for the day ;)

Okay you are VERY close to haveing what you need... this should work for you:

Rem  M3 Macro
Dim IgnitionDelay, PreheatDelay, PierceDelay
IgnitionDelay = getUserDRO (1001)
PreheatDelay = getUserDRO (1002)
PierceDelay = getUserDRO (1003)

ActivateSignal(Output1)
code "G4 P" & (IgnitionDelay)
While IsMoving()
Wend

ActivateSignal(Output2)
code "G4 P" & (PreheatDelay)
While IsMoving()
Wend

ActivateSignal(Output3)
code "G4 P" & (PierceDelay)
While IsMoving()
Wend
End
Fixing problems one post at a time ;)

www.newfangledsolutions.com
www.machsupport.com
Re: Macro Controlling Multiple Outputs
« Reply #2 on: November 11, 2006, 09:24:51 AM »
Whoa! Thanks!!!! I've been waiting for this moment for a long, long time! Thanks!!!

What's the difference between WEnd, Sub End, and End?
Re: Macro Controlling Multiple Outputs
« Reply #3 on: November 11, 2006, 01:11:42 PM »
Sub End is to end a Subroutine

Wend is the end of a While loop

End ... there is no end :) There is an End if and this tells the end of an if statement


Thanks
Brian
Fixing problems one post at a time ;)

www.newfangledsolutions.com
www.machsupport.com
Re: Macro Controlling Multiple Outputs
« Reply #4 on: November 14, 2006, 04:38:57 AM »
While your on about controlling outputs, how do you turn them off.

Thanks

Chris
Re: Macro Controlling Multiple Outputs
« Reply #5 on: November 14, 2006, 07:28:54 PM »
DeActivateSignal(Output3)  That will do it  :o
Fixing problems one post at a time ;)

www.newfangledsolutions.com
www.machsupport.com
Re: Macro Controlling Multiple Outputs
« Reply #6 on: November 14, 2006, 07:30:04 PM »
I've sorted it, I was been dumb, if anyone wishes to know it's simple really DeActivateSignal(output5)

This is what I'm trying to do.  Hopefully it will turn my spindle on on my bridgeport series 1 boss machine when I wire it in.

M3.m1s

If (GetOEMDRO (56) = 1) Then
DoSpinCW()
ActivateSignal(Output5)
Message "Spindle Start Requested"      
SystemWaitFor(Input2)            
While IsMoving ()              
Wend
DeActivateSignal(output5)                    
Message "Spindle Start Delay"        
Code "G4 P2"                  
While IsMoving                  
Wend                    
Message ""                  
Call SetUserLED(1010,1)
End If
If (GetOEMDRO (56) = 2) Then
DoSpinCCW()
ActivateSignal(Output6)
Message "Spindle Start Requested"      
SystemWaitFor(Input2)            
While IsMoving ()              
Wend          
DeActivateSignal(output6)
Message "Spindle Start Delay"        
Code "G4 P2"                  
While IsMoving                  
Wend                    
Message ""                  
Call SetUserLED(1010,1)
End If

It's a bit long but it seams to work when I simulate it, the M4 ones the same but the other way around.

Cheers

Chris
Re: Macro Controlling Multiple Outputs
« Reply #7 on: November 14, 2006, 07:40:06 PM »
No problem :) Looks like you are getting it!
Fixing problems one post at a time ;)

www.newfangledsolutions.com
www.machsupport.com