Run/Step Hold/Resume Buttons

  • txtrone
  • txtrone's Avatar Topic Author
  • Offline
  • Platinum Member
  • Platinum Member
More
02 Jun 2021 15:56 #211003 by txtrone
Run/Step Hold/Resume Buttons was created by txtrone

fgauder wrote:

I have to say,it is nice to be able to tell your machine how to run instead of having to learn to or get used to running a machine someone else has configured. I am sold on EMC.

In the original post on this thread, I proposed 2 buttons, one a Run/Step and the other a Pause/Resume. The controller I converted from had those 2 buttons close to an e-stop and until a program was proved out, 2 fingers stayed on them.

Thanks to John and Andy, I got my Pause/Resume button. I did a little work on my own and was able to get the Run/Step button (admittedly the far easier). So, for what it's worth, here is the program for both buttons:

loadrt and2 count=4
loadrt or2 count=1
loadrt toggle count=1
loadrt toggle2nist count=1

addf and2.0 servo-thread
addf and2.1 servo-thread
addf and2.2 servo-thread
addf and2.3 servo-thread
addf or2.0 servo-thread
addf toggle.0 servo-thread
addf toggle2nist.0 servo-thread

# External Program Pause/Resume and Run/Step Buttons
# Pause/Resume Section
net pause-resume-btn and2.0.in0 and2.1.in0 <= hm2_5i20.0.gpio.027.in_not (this is your input)
net pause-on toggle2nist.0.is-on and2.0.in1 and2.3.in1 <= halui.program.is-paused
net run-on and2.1.in1 <= halui.program.is-running
net pause-sig or2.0.in0 <= and2.0.out
net resume-sig or2.0.in1 <= and2.1.out
net toggle-ok toggle.0.in <= or2.0.out
net togglesig toggle2nist.0.in <= toggle.0.out
net toggleon halui.program.pause <= toggle2nist.0.on
net toggleoff halui.program.resume <= toggle2nist.0.off
# Run/Step Section
net run-step-btn and2.2.in0 and2.3.in0 <= hm2_5i20.0.gpio.026.in_not (this is your input)
net idle-on and2.2.in1 <= halui.program.is-idle
# net pause.on and 2.3.in1 <= halui.program.is-paused
# and2.3.in1 was added in the net pause-on statement in Pause/Resume Section
net run-sig halui.mode.auto halui.program.run <= and2.2.out
net step-sig halui.program.step <= and2.3.out

This is how they function:

Pressing Run/Step will begin executing a program.

Pressing Hold/Resume while a program is running will pause the program.

Pressing Run/Step while a program is paused will single step the program.

Pressing Hold/Resume while a program is paused will return it to normal run mode.

I hope this thread is of some help to someone.

Frank


I pasted this into my machine.hal file (edited it to add my inputs) and it spit this error:
twopass: Error in file ././plasmac/plasmac.tcl:
    Pin 'halui.program.is-idle' was already linked to signal 'idle-on'

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

More
02 Jun 2021 17:49 - 02 Jun 2021 17:51 #211009 by bevins
Replied by bevins on topic Run/Step Hold/Resume Buttons

fgauder wrote:

I have to say,it is nice to be able to tell your machine how to run instead of having to learn to or get used to running a machine someone else has configured. I am sold on EMC. and it spit this error:

twopass: Error in file ././plasmac/plasmac.tcl:
    Pin 'halui.program.is-idle' was already linked to signal 'idle-on'


Thats because program.is-idl;e signal is being used elsewhere by plasmac and you cant hijack it.
You can try to integrate it with plasmac, but that requires you to know the ins and outs of plasmac.
Plasmac is already doing what you want to do in the gui.

Last edit: 02 Jun 2021 17:51 by bevins.

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

  • txtrone
  • txtrone's Avatar Topic Author
  • Offline
  • Platinum Member
  • Platinum Member
More
02 Jun 2021 18:45 #211016 by txtrone
Replied by txtrone on topic Run/Step Hold/Resume Buttons

fgauder wrote:

I have to say,it is nice to be able to tell your machine how to run instead of having to learn to or get used to running a machine someone else has configured. I am sold on EMC. and it spit this error:

twopass: Error in file ././plasmac/plasmac.tcl:
    Pin 'halui.program.is-idle' was already linked to signal 'idle-on'


Thats because program.is-idl;e signal is being used elsewhere by plasmac and you cant hijack it.
You can try to integrate it with plasmac, but that requires you to know the ins and outs of plasmac.
Plasmac is already doing what you want to do in the gui.


I am trying to add an external pause/resume button.

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

More
02 Jun 2021 19:11 - 02 Jun 2021 19:12 #211018 by bevins
Replied by bevins on topic Run/Step Hold/Resume Buttons

fgauder wrote:

I have to say,it is nice to be able to tell your machine how to run instead of having to learn to or get used to running a machine someone else has configured. I am sold on EMC. and it spit this error:

twopass: Error in file ././plasmac/plasmac.tcl:
    Pin 'halui.program.is-idle' was already linked to signal 'idle-on'


Thats because program.is-idl;e signal is being used elsewhere by plasmac and you cant hijack it.
You can try to integrate it with plasmac, but that requires you to know the ins and outs of plasmac.
Plasmac is already doing what you want to do in the gui.


I am trying to add an external pause/resume button.


Yes but there is already pause resume being used by plasmac in the gui. You have to make it coexist.

Last edit: 02 Jun 2021 19:12 by bevins.

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

More
02 Jun 2021 19:25 - 02 Jun 2021 19:26 #211019 by rodw
Replied by rodw on topic Run/Step Hold/Resume Buttons
Plasmac is quite difficult to extend becasue it uses so many pins but I think you should place this code in the postgui file.

try replacing
net idle-on and2.2.in1 <= halui.program.is-idle
with
net and2in and.2.2.in1 <= idle-on

Any example like this usually needs some massaging to fold into your config. I implemented this well before Plasmac existed and had similar issues.
Last edit: 02 Jun 2021 19:26 by rodw.
The following user(s) said Thank You: txtrone

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

  • txtrone
  • txtrone's Avatar Topic Author
  • Offline
  • Platinum Member
  • Platinum Member
More
02 Jun 2021 19:39 #211020 by txtrone
Replied by txtrone on topic Run/Step Hold/Resume Buttons

Plasmac is quite difficult to extend becasue it uses so many pins but I think you should place this code in the postgui file.

try replacing
net idle-on and2.2.in1 <= halui.program.is-idle
with
net and2in and.2.2.in1 <= idle-on

Any example like this usually needs some massaging to fold into your config. I implemented this well before Plasmac existed and had similar issues.


Rod - Does all of the code I originally posted belong in my postgui?

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

More
02 Jun 2021 19:43 #211021 by rodw
Replied by rodw on topic Run/Step Hold/Resume Buttons
yeh, I'd keep it all together.

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

  • txtrone
  • txtrone's Avatar Topic Author
  • Offline
  • Platinum Member
  • Platinum Member
More
02 Jun 2021 20:14 - 02 Jun 2021 20:29 #211022 by txtrone
Replied by txtrone on topic Run/Step Hold/Resume Buttons

yeh, I'd keep it all together.


This is all in my postui.tcl now ... I can verify in halshow that input01 and 02 are receiving signal from my external inputs... but they do not pause/resume plasmac.

EDIT: I created another postgui hal file and put the code in that file. I named it stopandgo.hal ... it is listed in my machine.ini file like so:
[HAL]
# required
TWOPASS = ON
# the base machine
HALFILE = mark_i.hal
# the plasmac component connections
HALFILE = ./plasmac/plasmac.tcl
# the plasma machine  and custom connections
HALFILE = mark_i_connections.hal
# use this for customisation after GUI has loaded
POSTGUI_HALFILE = ddraft4x2.hal
POSTGUI_HALFILE = stopandgo.hal
# required
HALUI = halui

The stopandgo.hal contains this code:
loadrt and2 count=4
loadrt or2 count=1
loadrt toggle count=1
loadrt toggle2nist count=1

addf and2.0 servo-thread
addf and2.1 servo-thread
addf and2.2 servo-thread
addf and2.3 servo-thread
addf or2.0 servo-thread
addf toggle.0 servo-thread
addf toggle2nist.0 servo-thread

# External Program Pause/Resume and Run/Step Buttons

# Pause/Resume Section
net pause-resume-btn and2.0.in0 and2.1.in0 <= hm2_7i76e.0.7i76.0.0.input-01
net pause-on toggle2nist.0.is-on and2.0.in1 and2.3.in1 <= halui.program.is-paused
net run-on and2.1.in1 <= halui.program.is-running
net pause-sig or2.0.in0 <= and2.0.out
net resume-sig or2.0.in1 <= and2.1.out
net toggle-ok toggle.0.in <= or2.0.out
net togglesig toggle2nist.0.in <= toggle.0.out
net toggleon halui.program.pause <= toggle2nist.0.on
net toggleoff halui.program.resume <= toggle2nist.0.off

# Run/Step Section
net run-step-btn and2.2.in0 and2.3.in0 <= hm2_7i76e.0.7i76.0.0.input-02
net and2in and2.2.in1 <= idle-on
# net pause.on and 2.3.in1 <= halui.program.is-paused
# and2.3.in1 was added in the net pause-on statement in Pause/Resume Section
net run-sig halui.mode.auto halui.program.run <= and2.2.out
net step-sig halui.program.step <= and2.3.out

The buttons are triggering a response in halshow, but plasmac does not respond.
Last edit: 02 Jun 2021 20:29 by txtrone.

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

  • txtrone
  • txtrone's Avatar Topic Author
  • Offline
  • Platinum Member
  • Platinum Member
More
03 Jun 2021 16:46 #211094 by txtrone
Replied by txtrone on topic Run/Step Hold/Resume Buttons

Yes but there is already pause resume being used by plasmac in the gui. You have to make it coexist.


I know, that is what I am trying to figure out how to do. Do you know how to accomplish this?

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

More
03 Jun 2021 19:02 - 03 Jun 2021 19:04 #211097 by bevins
Replied by bevins on topic Run/Step Hold/Resume Buttons

Yes but there is already pause resume being used by plasmac in the gui. You have to make it coexist.


I know, that is what I am trying to figure out how to do. Do you know how to accomplish this?


I dont have the plasmac. I quickly up[graded top QTplasmaC as it is much easier for me to see what is going on. Everything is in the hal and ini files.
Plasmac I never understood the structure.

I would approach it using the or2 function. So basically if you want pause/resume, then you want two inputs, 1. plasmac gui or external input. I dont know how you would do that in plasmac but in QT I have an idea how I would accomplish it.

That's just my thoughts. I see you are already tryuing. I'd wait to see if phil or snowgoer responds.
Last edit: 03 Jun 2021 19:04 by bevins.
The following user(s) said Thank You: txtrone

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

Moderators: snowgoer540
Time to create page: 0.103 seconds
Powered by Kunena Forum