Run g-code on event from hal pin

More
5 years 5 months ago #209471 by aleksamc
I got some problem my new machine that is under testing.
I run remapped m-code that rotates asynchronous motor from M66 to end limit switch, when it reach the switch, or time for wait for switch is out (logic made in classic ladder), motor stoppes.

But If I interrupt running g-code with e-stop, program stoppes but motion-out (from M66) is still run. It's as bug for me.
Only restart of linuxcnc helped.

My task:
I need to reset all motion-out pins when I got event/triger from e-stop or stop of program.
How to do this, I think it should be made in HAL.

Please Log in to join the conversation.

More
5 years 5 months ago #209538 by andypugh
You could consider using "and2" on each pin with halui.mode.is-auto, so the output is only true when G-code is running _and_ the digital output is set.

You can only set the actual pin state from G-code.

Look at the MDI_COMMAND INI entries and the halui.mdi-command-NN HAL pins. It is possible that M2 will reset all the outputs, otherwise the G-code that runs when the pin goes high will need to be an O-word subroutine.

Please Log in to join the conversation.

More
5 years 5 months ago #209539 by andypugh

andypugh wrote: You can only set the actual pin state from G-code.


A user-space Python HAL component could send the G-code, and could monitor state.

Please Log in to join the conversation.

More
5 years 5 months ago #209619 by aleksamc
I will study Python HAL docs, it's really new for me.
Currently I study C++ and made some success in "studing", possibly, it's better to try such think and halcompile and to have some practice.

You could consider using "and2" on each pin with halui.mode.is-auto, so the output is only true when G-code is running _and_ the digital output is set.


My logic is made in classic lader module, so there is present limit switches and e-stop signals as AND logic. But as previously heppened, when motion-out-nn stucked, I couldn't restart it, it was always ON, I could only restart linuxcnc.

Please Log in to join the conversation.

Time to create page: 0.077 seconds
Powered by Kunena Forum