Machsupport Forum

Mach Discussion => VB and the development of wizards => Topic started by: Mattb on August 03, 2010, 03:43:46 PM

Title: Activating/Deactivating E-Stop from within VB?
Post by: Mattb on August 03, 2010, 03:43:46 PM
I'm trying to find a way to temporarily activate the E-Stop during the execution of a script.

I want to do something like:

code...
activate E-Stop
more code...
deactivate E-stop
finish code...

Seems like it should be easy enough to do, but I haven't been able to find anything after a fair bit of digging around, so I'm starting to wonder if this is something I can do.

Any thoughts?

-Matt
Title: Re: Activating/Deactivating E-Stop from within VB?
Post by: DaveCVI on August 03, 2010, 04:03:55 PM
Hi,

No offense, but I think either there is a terminology issue here - Or perhaps you want to rethink the desire to disable estop via software.

E-stop circuits are supposed to external to mach and all hardware based. My understanding is that multiple countries have safety regulations which prohibit having software as part of the E-Stop facilities. An E-Stop facility has to always work and can never be disabled. This is not the same as the machine being disabled- when an estop circuit says "don't run", the machine is disabled - but the e-stop logic circuit is not - it is doing it's job of keeping the machine from running.

I suspect the reason that there is no script API for "disabling e-stop" is that this would be a safety problem (and in contradiction of various regulatory agencies).

Consider:
1) mach disables e-stop
2) run some script that causes movement etc - and it goes wrong....
3) operator lunges for e-stop button only to find it is not working (estop is disabled)... very bad mojo.

Now then, if instead of estop, you mean that you want to make Mach3 change states between "ready" and "not ready" - that you can do from a script - it's the reset OEM button call which does this.
Note that you will not be able to make mach "ready" if the e-stop input signal is active - which is how things should be.

Just my 2 cents worth...

Dave


Title: Re: Activating/Deactivating E-Stop from within VB?
Post by: Mattb on August 03, 2010, 04:17:24 PM
Dave - you're right, I was using the wrong terminology.

I'm looking to change the state between read & not-ready from within a script.  I know you can create a standalone button to do this, but I haven't been able to write the code to do it within a script.
Title: Re: Activating/Deactivating E-Stop from within VB?
Post by: DaveCVI on August 03, 2010, 04:55:12 PM
Ah, ok then ....

Get the latest Programmer's ref manual (v0.22) from the documentation page of machsupport.com
Look at the DoOEMButton() function description, then
see the magic numbers in tables near the end - I think you want button 1021.

Dave
Title: Re: Activating/Deactivating E-Stop from within VB?
Post by: BR549 on August 03, 2010, 05:04:39 PM
Dobutton(21)      toggles the estop. If you want a safety then add in a reference to the led in your code

Title: Re: Activating/Deactivating E-Stop from within VB?
Post by: DaveCVI on August 03, 2010, 06:10:57 PM
Be aware that DoButton is deprecated - please do not use it for new code.
The older DoButton call is slated to go away in Mach3 V4.

Use DoOEMButton instead.

Dave

Title: Re: Activating/Deactivating E-Stop from within VB?
Post by: BR549 on August 03, 2010, 06:57:03 PM
HIYA Dave, Just to mention that Fanuc learned a valuable lesson long ago about depreciating old code. After that mess they put it back in(;-) pronto.

Just a thought,(;-)
Title: Re: Activating/Deactivating E-Stop from within VB?
Post by: DaveCVI on August 03, 2010, 07:59:11 PM
Terry,
The fact is that DoButton should not be used for new code. Period. End of story. No If's, And's or but's about it.  8)
The poster was clearly writing a new script.
There is simply no % in writing new code that uses deprecated APIs.

I just report the decisions as I've been told them:
On V4 the plan is to allow two types of scripts to run:
1) V4 API mode - this will use calls that use the new resource numbering scheme. So these scripts will HAVE to be all new (or rewritten versions of old scripts).

2) V3 compatibility mode - this will be (most of the) existing scripts using V3 API calls.
My understanding of current plans is that DoButton, Get/SetDRO and Get/SetLED et all, are going to be disabled in v4 - including the V3 API mode in V4.   

It's literally been years since the old style calls were deprecated - ever since the DoOEMButton, GET/SET-OEM/User-LED/DRO functions calls were added - that's been a very long time.

I've been in the software game since the late 1960's. - You can believe me when I say that I understand the issues around API changes.

If you want to see some of the issues you're fond of complaining about resolved, you'll have to get used to using some new calls. Some things just can not be fixed using the old API calls - that's a fact.

In all cases,  the use of deprecated calls is a bad idea for new code.

(and it doesn't matter how nice an old API looks on the shelf next to the worn out buggy whip...  :P )

Dave

HIYA Dave, Just to mention that Fanuc learned a valuable lesson long ago about depreciating old code. After that mess they put it back in(;-) pronto.

Just a thought,(;-)
:P
Title: Re: Activating/Deactivating E-Stop from within VB?
Post by: BR549 on August 04, 2010, 07:10:56 PM
HIYA DAVE, If you fail to learn from history you are doomed to repeat it. NOT a problem for me as I have NEVER had a problem with dobutton or DoOemButton both work just fine and I bet the old "real" problems people have complained about over the years will still be there in V4.

Here is my point IF you can fix it with a NEW CALL why can't you fix the OLD CALL to work JUST like the NEW call without calling it something new OR just call the NEW CALL  the same thing as the OLD CALL and then do away with the old code. That way ALL the old programs still work.

IF you improved the old WHEEL so it rolled better would you call the new wheel  a "BOX "or still call it a wheel????

PROBLEM SOLVED buggerwhipper style (;-)
Title: Re: Activating/Deactivating E-Stop from within VB?
Post by: BR549 on August 04, 2010, 08:08:05 PM
OH heck I forgot, I have been in the machine tool  game since the late 60s-- You can believe me when I say that I understand the issues around MACHINE CODE changes.

(;-) TP
Title: Re: Activating/Deactivating E-Stop from within VB?
Post by: BR549 on August 04, 2010, 11:15:32 PM
AND yes folks it would probably be best to use the more modern calls. (;-)
Title: Re: Activating/Deactivating E-Stop from within VB?
Post by: Tweakie.CNC on August 05, 2010, 02:25:55 AM
Thanks for that clarification Terry, it all makes sense now.

(I just get the Buggywhipper sorted now you introduce Buggerwhipper  ;D )

Tweakie.
Title: Re: Activating/Deactivating E-Stop from within VB?
Post by: BR549 on August 05, 2010, 11:06:57 AM
Heck Tweakie sometimes you just have to make up new words as you go(;-)

Bad fingers BAD BAD slap slap, there I fixed that, it better not happen again(;-)