Machsupport Forum
Mach Discussion => General Mach Discussion => Topic started by: derek on October 04, 2012, 07:05:16 AM
-
Starting to work out the details on my tool change macro for my ATC.
Ran into a bit of a stumble right away. Here's what I'm trying to accomplish:
ActivateSignal( OUTPUT5 )
Wait for signal from proximity switch on input 1 then
ActivateSignal( OUTPUT6 )
I've searched and tried a few things but a can't seem to get it figured out.
Thanks
Derek
-
This may work for you.
Hood
Do
ActivateSignal(OutPut5)
If IsActive(Input1) Then Exit Do
sleep 10
Loop
ActivateSignal(Output6)
-
Hi Hood
Thanks for the help.
I kicks an error "Error on line:2-Exit for/do not within for/do loop"
Any ideas?
Thanks
Derek
-
Works perfectly here, just tried. What else do you have in the macro as that is likely the problem.
Hood
-
Just another method, The GetUserDRO(2000) is a safety to get OUT of the loop if needed. For the macro to work you need to first set the UserDro(2000) to 99 with SetUserDro(2000,99). I have a saftey button on screen with the exit code "SetUserDro(2000,0)" that allows the loop to exit else you may stay in an endless loop.
ActivateSignal(OutPut5)
Do While Not IsActive(Input1) And GetUserDro(2000) = 99
sleep (10)
Loop
ActivateSignal(Output6)
End
Just a thought, TP
-
Thanks guys
I'll play some more tomorrow as for now I'm home BBQing some pork chops!
Thanks for the help
Derek
-
Well I couldn't get hoods to work but a modified BR549 did the trick.
ActivateSignal(OutPut5)
Do While Not IsActive(Input1)
sleep (10)
Loop
ActivateSignal(Output6)
I'm confused as to the SetUserDro(2000,99) safety does.
Thanks
Derek
-
Just a note , Hoods code worked here as well. (;-) The safety was added to allow you to break OUT of the loop if needed. IF your Input1 relay failed it would stay in the loop as a never ending loop with no way out. With the safety as soon as you pushed the safety button and it changed the value of the safety DRO it would break out of the loop and allow you to continue without having to shut down the computer completely.
(;-) TP
-
Just a note , Hoods code worked here as well. (;-) The safety was added to allow you to break OUT of the loop if needed. IF your Input1 relay failed it would stay in the loop as a never ending loop with no way out. With the safety as soon as you pushed the safety button and it changed the value of the safety DRO it would break out of the loop and allow you to continue without having to shut down the computer completely.
(;-) TP
Thats weird!
I was really careful about typing the correct stuff and tried it a few times. It just kept kicking that error message. Is it possible that something is corrupt or needs updating on the computer?
I'm going to try it on a different machine and see what I get.
Thanks for the explanation on the safety.
Derek