Run g-code on event from hal pin
19 May 2021 09:35 #209471
by aleksamc
Run g-code on event from hal pin was created 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.
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 or Create an account to join the conversation.
19 May 2021 18:57 #209538
by andypugh
Replied by andypugh on topic Run g-code on event from hal pin
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.
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 or Create an account to join the conversation.
19 May 2021 18:59 #209539
by andypugh
A user-space Python HAL component could send the G-code, and could monitor state.
Replied by andypugh on topic Run g-code on event from hal pin
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 or Create an account to join the conversation.
20 May 2021 07:49 #209619
by aleksamc
Replied by aleksamc on topic Run g-code on event from hal pin
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.
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.
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 or Create an account to join the conversation.
Time to create page: 0.066 seconds