Setting motion.analog-out-xx to 0 when starting the machine

More
3 years 8 months ago #263444 by HiSH
Is it possible to set an motion.analog-out-xx pin to 0, wenn starting the machine?
I remap an  gcode and set in an owert-function an motion.analog-out pin to an value x.
If an error occurs an estop will be triggert. But anyway the motion.analog-out pin remains on
the value x.

Please Log in to join the conversation.

More
3 years 8 months ago #263457 by andypugh
If you are using remap then you can possibly use the ON_ABORT functionality:

linuxcnc.org/docs/devel/html/remap/remap...g_dealing_with_abort

Please Log in to join the conversation.

More
3 years 8 months ago #263462 by rodw
The other approach if not remapping is to and2 it with another pin that comes on with the machine before using the value.
motion.motion-enabled may do it.

Please Log in to join the conversation.

More
3 years 8 months ago #263505 by HiSH
Thank you! That is what i searched for and it works as expected, but when switching on the machine, i got the error:

0: nicht in der Definition einer Unterfunktion: 'o<on_abort> endsub'
(or
0: not declared in a subroutine: 'o<on_abort> endsub' )

In my INI-File:
...
[RS274NGC]
REMAP=S argspec=s ngc=s
ON_ABORT_COMMAND=O <on_abort> call
...

in on_abort.ngc:

o<on_abort> sub

(DEBUG, parameter is [#1])
o100 if [#1 eq 5]
  (machine on)
o100 elseif [#1 eq 6]
  (machine off)
o100 elseif [#1 eq 7]
  M68 E0 Q0
  (estopped)
o100 elseif [#1 eq 8]
  (msg, abort pressed)
o100 else
  (DEBUG, error parameter is [#1])
o100 endif

o<on_abort> endsub
m2

What do i wrong?

Please Log in to join the conversation.

More
3 years 8 months ago #263506 by HiSH
@rodw:
Thank you. I remember your solution, if i couldn't solve the problem, with
the described error. The advantage of the ON_ABORT solution is, that
i could do other initialsations too.

Please Log in to join the conversation.

More
3 years 8 months ago #263655 by andypugh
There is something funny about % and M2 methods of marking file ends. I can't remember the details right now, but you could try putting % at the start and end of the subroutine file and removing the M2.
But this is just a wild guess, and probably won't work.

Please Log in to join the conversation.

More
3 years 8 months ago #263656 by andypugh

The other approach if not remapping is to and2 it with another pin that comes on with the machine before using the value.
motion.motion-enabled may do it.
You can't use and2 with a numerical value, but a muxN or mux-generic could be used. 

Please Log in to join the conversation.

More
3 years 8 months ago #263662 by MaHa
I tested your on_abort.ngc  without error.

Attachment not found

Please Log in to join the conversation.

More
3 years 8 months ago #263805 by HiSH
Ups, thats mysterious. I got the error only when using the on_abort.ngc.

Please Log in to join the conversation.

More
3 years 8 months ago #263881 by andypugh

I tested your on_abort.ngc  without error.
As an ON_ABORT subroutine, or manually?
 

Please Log in to join the conversation.

Time to create page: 0.257 seconds
Powered by Kunena Forum