Machsupport Forum
Mach Discussion => VB and the development of wizards => Topic started by: Sweep on September 19, 2012, 04:04:15 PM
-
Still experimenting with my first bit of code, RAH, to allow me to interface my ATC.
I have wired Mach input #1 to one of the onboard relays of the ATC that changes state whilst the ATC is in motion. My thought was that if I Sleep the RAH code for the longest period it takes to datum the ATC carousel, i.e. rotating all the way from station 6 to station 1, and then IsActive input #1 I can either continue through the program or initiate a user reset.
What I am not happy with is the DoButton(3) stop command as it doesn't seem correct as Mach isn't running any Gcode at this point so can't stop anything. I would like to initiate an Estop type of condition where the system prevents any further action until the reset button is pressed but I can't figure out what command is needed.
Please feel free to comment on the code in general for mistakes as I am still learning (guessing!) so I expect there are plenty.
thanks ...Sweep
DoButton( 24 )
DoButton( 23 )
DoButton( 22 )
DoButton( 25 )
Sleep(100)
While IsMoving()
Sleep(100)
Wend
SendSerial("B0000133E167R25")
Sleep 2000
If IsActive(INPUT1) Then
SendSerial("D44")
Else
SetTicker(0,"Toolchanger datum failed ...check air supply")
Dobutton(3)
End If
Sleep 5000
If IsActive(INPUT1) Then
Message"ATC Datum Achieved"
Else
SetTicker(0,"Toolchanger datum failed ...reset ATC")
Dobutton(3)
End If
-
I thought using the serial for the ATC that all atc motions were controlled via the ATC and IT would send ok or clear or FAIL signals BACK to MACH3 via serial.
You would signal the ATC via serial to do an action then wait for the responce from the ATC such as OK, clear, fail,etc that indicated it is ready to go or failed in the function.
Just a thought, (;-) TP
-
I would like to initiate an Estop type of condition where the system prevents any further action until the reset button is pressed but I can't figure out what command is needed.
DoOEMButton(1021)
Then add an
Exit Sub
-
Thanks for your responses guys.
I am sure that the ATC did originally use the serial port 'handshake' as you describe TP but I was under the impression that Mach can only send via the serial port and not act on incoming data strings.
Fortunately for me the Denford ATC also has two relays that change state depending on the toolchanger condition: one opens its contacts when the ATC is in motion, whilst the other only changes state if the ATC receives a bad, unintelligible, string of data.
These two relays were originally also connected back to the Denford motherboard by DIN plugs and cable so must have performed a similar function.
I will try the 1021 button tonight Gerry.
Many thanks to you both ...Sweep
-
Not sure why I can't edit my last post, but I can't so adding further comment here:
Hi TP.
It would make better sense to use Serial input strings from the ATC than relying on approximate Sleep times to step through the program, but according to page 107 of the Macro Programmers Guide, Serial Output Functions Grouped Alphabetically, it says "Serial input is not supported in Mach3 v3."
If there is a way for Mach to deal with serial input, or my info is out-of-date, please advise where I can get some info as this would potentially give a better solution.
Hi Gerry.
I noticed the 1021 button but misunderstood it being just to "reset" a fault condition but I guess it actually toggles between fault and reset.
Lots to learn!
thanks ...Sweep
-
Event driven serial . Use the serial monitor to see what is coming and going.
(;-) TP
-
Hi TP,
Just located your post and attachment from 19th July 2011 which seems to suggest you are correct ...but you knew that anyway ;)
Reading through the attachement it does seem quite a step above my 2 days experience of programming, and I will need to understand what the ATC return strings mean and if they are tool number dependent etc., but is definitely something that I will be looking at.
For now I will probably experiment with relying on the relays as that is a only switched when the ATC has finished its cycle and is something my 'mechanical' mind can visualise.
Many thanks ...Sweep
-
Th easy way is to give the ATC a command to do a function and then wait to see what it sends back IF all is well.
(;-) TP
-
I would like to initiate an Estop type of condition where the system prevents any further action until the reset button is pressed but I can't figure out what command is needed.
DoOEMButton(1021)
Then add an
Exit Sub
The only problem with the DoOEMButton(1021) command is that it has a predefined Message and Ticker response that seems to take precedence over my "SetTicker(0,"Toolchanger datum failed ...check air supply")"