external program run button

More
12 Mar 2018 21:58 #107265 by h2omatt26
I have built a 3 axis gantry and using a leadshine mx4660 to control it over parallel port. I used stepconf to do the initial set up of the machine and have enabled halui. I'm new to hal programming and having issues getting a external program run/start button to work. i will post my .ini and .hal asap. Any help would be great

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

More
13 Mar 2018 02:55 #107269 by rodw

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

More
13 Mar 2018 13:52 #107275 by h2omatt26
Thanks rodw, I saw that post. but i'm looking for just a simple start button. I currently have a normally open button connected to pin 12 of my parallel port.

I liked what SenorAguas was doing but it seems he switched over to what you suggested. i dont really understand the and2 logic and just need a start button. forum.linuxcnc.org/24-hal-components/318...-button-pause-switch

does adding this to my hal work? what would i need to change or simplify?

loadrt and2 count=2
addf and2.0 servo-thread
addf and2.1 servo-thread

#start button

net program-start-btn halui.mode.auto and2.0.in0 <= parport.0.pin-12-in
net program-run-ok and2.0.in1 <= halui.mode.is-auto
net remote-program-run and2.0.out => halui.program.run
Attachments:

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

More
13 Mar 2018 16:19 - 13 Mar 2018 16:20 #107279 by Todd Zuercher
If you just want a simple start button I think you only need.
net prog-start-btn <= parport.0.pin-12-in => halui.program.run

It is when you try to get fancy and make the button do more than one thing like run/pause/resume, that you need the other stuff.
Last edit: 13 Mar 2018 16:20 by Todd Zuercher.
The following user(s) said Thank You: Tchefter

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

More
13 Mar 2018 16:55 #107282 by h2omatt26
That works!! I had tried something similar but forgot the "=>". I am looking forward to learning and experimenting with this further.

Thanks for your support!!!

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

More
13 Mar 2018 17:21 #107283 by Todd Zuercher
The arrow marks are optional, and are only there for human readability. Their existence or direction they point makes no difference in the functionality of the line code. If it didn't work for you before, there was some other reason.

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

More
13 Mar 2018 17:26 - 13 Mar 2018 17:26 #107285 by Todd Zuercher
In other words these lines are all exactly the same
net prog-start-btn <= parport.0.pin-12-in => halui.program.run
net prog-start-btn  parport.0.pin-12-in  halui.program.run
net prog-start-btn => parport.0.pin-12-in <= halui.program.run
net prog-start-btn  parport.0.pin-12-in => halui.program.run
net prog-start-btn  halui.program.run  parport.0.pin-12-in
Last edit: 13 Mar 2018 17:26 by Todd Zuercher.
The following user(s) said Thank You: Clive S, Tchefter

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

More
13 Mar 2018 18:03 #107287 by h2omatt26
Todd, thanks for the information!! Very interesting!!!

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

More
13 Mar 2018 19:03 #107291 by Clive S
Replied by Clive S on topic external program run button
Thanks Tod I did not realise that the order in the line made no difference.

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

More
13 Mar 2018 19:24 #107294 by Todd Zuercher
Also if you are connecting more than one hal pin, they don't even have to be on one line or even in the same hal file. These two lines together would also be equivalent to the above single lines.
net prog-start-btn  halui.program.run
net prog-start-btn  parport.0.pin-12-in

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

Time to create page: 0.141 seconds
Powered by Kunena Forum