Hello Guest it is April 19, 2024, 08:38:06 AM

Author Topic: Triggering a user reset  (Read 4771 times)

0 Members and 1 Guest are viewing this topic.

Offline Sweep

*
  •  150 150
    • View Profile
    • pollz.co.uk
Triggering a user reset
« 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
« Last Edit: September 19, 2012, 04:10:19 PM by Sweep »

Offline BR549

*
  •  6,965 6,965
    • View Profile
Re: Triggering a user reset
« Reply #1 on: September 19, 2012, 07:00:03 PM »
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

Offline ger21

*
  • *
  •  6,295 6,295
    • View Profile
    • The CNC Woodworker
Re: Triggering a user reset
« Reply #2 on: September 19, 2012, 07:38:38 PM »
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
Gerry

2010 Screenset
http://www.thecncwoodworker.com/2010.html

JointCAM Dovetail and Box Joint software
http://www.g-forcecnc.com/jointcam.html

Offline Sweep

*
  •  150 150
    • View Profile
    • pollz.co.uk
Re: Triggering a user reset
« Reply #3 on: September 20, 2012, 01:57:55 AM »
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

Offline Sweep

*
  •  150 150
    • View Profile
    • pollz.co.uk
Re: Triggering a user reset
« Reply #4 on: September 20, 2012, 03:26:50 AM »
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
« Last Edit: September 20, 2012, 03:29:31 AM by Sweep »

Offline BR549

*
  •  6,965 6,965
    • View Profile
Re: Triggering a user reset
« Reply #5 on: September 20, 2012, 10:47:45 AM »
Event driven serial . Use the serial monitor to see what is coming and going.

(;-) TP

Offline Sweep

*
  •  150 150
    • View Profile
    • pollz.co.uk
Re: Triggering a user reset
« Reply #6 on: September 20, 2012, 02:00:13 PM »
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

Offline BR549

*
  •  6,965 6,965
    • View Profile
Re: Triggering a user reset
« Reply #7 on: September 20, 2012, 04:50:24 PM »
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

Offline Sweep

*
  •  150 150
    • View Profile
    • pollz.co.uk
Re: Triggering a user reset
« Reply #8 on: September 24, 2012, 07:06:47 PM »
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")"