Machine On button.

More
04 Oct 2024 12:51 #311280 by Dougal9887
Hi,
I've been using LinuxCNC for a couple of years now, but apart from setting up using the stepconf wizard, I have not attempted any other interaction with Linux.
So please assume no prior knowledge!
I would like to be able to switch on my machine, using a relay interface board controlled by a bob pin.
Unlike Estop, Machine On does not appear as a choice in Stepconf.
I thought this might be as simple as adding a couple of lines to the .hal file, similar to those used for the coolant button. However I just get a message reporting that Machine On isn't recognised.
Any help in getting the machine on button to actually do what it is supposed to do would be much appreciated. 
Thanks, Dougal.

Please Log in or Create an account to join the conversation.

More
04 Oct 2024 13:54 #311283 by Aciera
Replied by Aciera on topic Machine On button.
in your hal try:
net machine-on          <= <your-pin-here>    => halui.machine.on

Please Log in or Create an account to join the conversation.

More
04 Oct 2024 15:06 #311289 by Dougal9887
Replied by Dougal9887 on topic Machine On button.
Many thanks for your reply!
I will go and try that right now and report back.

Please Log in or Create an account to join the conversation.

More
04 Oct 2024 16:24 #311296 by Dougal9887
Replied by Dougal9887 on topic Machine On button.
Gmoccapy started now without error, but the button does not change the state of pin 16 unfortunately.  I've attached pic of line 55 added.
Any more ideas?
Thanks, Dougal.
Attachments:

Please Log in or Create an account to join the conversation.

More
04 Oct 2024 16:54 - 04 Oct 2024 16:56 #311298 by Aciera
Replied by Aciera on topic Machine On button.
I misunderstood what you wanted. If you want to output a signal when the machine is on then change this:
net machine-on => parport.0.pin-16-out => halui.machine.on


to:
net machine-on => parport.0.pin-16-out <= halui.machine.is-on
Last edit: 04 Oct 2024 16:56 by Aciera.

Please Log in or Create an account to join the conversation.

More
04 Oct 2024 17:48 - 04 Oct 2024 17:50 #311302 by Dougal9887
Replied by Dougal9887 on topic Machine On button.
Just to be clear, what I want to do is to switch on a singe power supply providing power to the computer and machine (but not switching either on). I will then start the computer and Linuxcnc. When the Gmoccapy screen opens I toggle the software estop (which I do not use) and this enables the machine on button. I wish to be able to press this button to ground a relay on pin 16 on the BoB (which is already receiving power from the usb). This relay will then switch main power on to the machine.
Is this what the second version of code will accomplish?
Thanks,
Dougal.
Last edit: 04 Oct 2024 17:50 by Dougal9887.

Please Log in or Create an account to join the conversation.

More
04 Oct 2024 18:31 #311305 by Dougal9887
Replied by Dougal9887 on topic Machine On button.
Yup, that works just as I want  .
Many thanks for the help.
Dougal.

Please Log in or Create an account to join the conversation.

More
08 Oct 2024 06:55 #311542 by Dougal9887
Replied by Dougal9887 on topic Machine On button.
Despite the fact that, following the above, switching on the machine from gmoccapy now, and happily, does exactly that, I am trying to understand a little of how and why.

I think I can now see that the first response, 'machine.on', appears to be correct.
However, when that didn't work and I attached the snippet of code, the respondent was alerted to the code being that code run before the gui started and changed the response to 'machine.is-on'.
I put the line of code in the configuration  .hal file simply because it was the only file I have ever altered.
It now appears to me that, since the action I wanted occurs after the gui is open, the code should have appeared in a postgui hal file.
So my question now please is, to achieve the action stated above, what should the line of code look like to attach the gmoccapy 'machine on' button to parallel port pin 16 and switch on the machine, where should the line of code be written and where would I find that place?

It would also be interesting to understand why 'machine.is-on' works to toggle the button on/off when it is described as an input, presumably to display the current state of the machine.

Thanks, Dougal. 

Please Log in or Create an account to join the conversation.

More
08 Oct 2024 07:25 #311544 by Aciera
Replied by Aciera on topic Machine On button.

I think I can now see that the first response, 'machine.on', appears to be correct.

'halui.machine.on' is an input that is used to put the machine in the 'on' state. I suggested using this because I falsely thought you wanted to use an external switch to do that.

It now appears to me that, since the action I wanted occurs after the gui is open, the code should have appeared in a postgui hal file.

Since we are not using any gmoccapy related pins there is no need to put this in the postgui_halfile. 'halui' pins exist already before the gui has loaded. The button state in the gui reflects the state of 'machine.is-on'.

It would also be interesting to understand why 'machine.is-on' works to toggle the button on/off when it is described as an input, presumably to display the current state of the machine.


'halui.machine.is-on' is an _output_ that reflects the current state of the machine.

linuxcnc.org/docs/html/gui/halui.html#_machine

Please Log in or Create an account to join the conversation.

More
08 Oct 2024 10:39 #311552 by Dougal9887
Replied by Dougal9887 on topic Machine On button.
Thank you for that very clear explanation.
Reading that document, now from a different perspective, makes sense.
Dougal.

Please Log in or Create an account to join the conversation.

Moderators: newbynobiHansU
Time to create page: 0.124 seconds
Powered by Kunena Forum