toggle2nist description

More
9 years 8 months ago #87570 by jensor
I don't know why the man page for toggle2nist does not give a complete description for understanding toggle2nist. I ran some tests with it to find out exactly how it behaves.
When is-on changes state it always drives both outputs to false. then only one toggle is allowed on in pin per attached truth table.

Looks like i'm not allowed to attach my truth table so I'll try to explain it. If in is false when is-on goes false, off goes true.If in is true when is-on goes true, on goes true.

toggle2nist description.xlsx

Here I'll try to build a table but I see the html screws up the spacing.

toggle2nist
is-oninonoffoutput
00000
0101
0001note: no change
0102note: no change
1100
1010
1110no change

Please Log in to join the conversation.

More
9 years 8 months ago #87611 by bkt
Replied by bkt on topic toggle2nist description
at these link ...

Code:
component toggle2nist "toggle button to nist logic"; description """ toggle2nist can be used with a momentary push button connected to a toggle component to control a device that has seperate on and off inputs and has an is-on output. If in changes states via the toggle output If is-on is true then on is false and off is true. If is-on is false the on true and off is false. """; pin in bit in; pin in bit is_on; pin out bit on; pin out bit off; variable int old_in; variable int to_state=0; function _ nofp; license "GPL"; ;; FUNCTION(_) { if (in!=old_in) /* a toggle has occurred */ { if (is_on) { /* turn OFF if it's on */ on=0; off=1; to_state=0; } else if (!is_on) { /* turn ON if it's off */ on=1; off=0; to_state=1; } } else { /* reset pins when we see the desired state */ if (to_state==is_on) { on=0; off=0; } } old_in=in; }


toggle2nist code ....

I hope these help.
Giorgio

Please Log in to join the conversation.

More
9 years 8 months ago #87658 by jensor
Replied by jensor on topic toggle2nist description
Thank you for your comments, Giorgio however I am not skilled in the programming language in your response.
I think a better description for my understanding would be:
A reset condition occurs whenever "is-on" changes state. When in the reset condition both outputs are false.
If in the reset condition "is-on" is false, a change of state of "in" changes "on" to true.
If in the reset condition "is-on" is true, a change of state of "in" changes "off" to true.
Further changes in output will not occur until unit is reset by change of state of "is-on"

Please Log in to join the conversation.

More
9 years 8 months ago #87666 by bkt
Replied by bkt on topic toggle2nist description

toggle2nist can be used with a momentary push button connected to a
toggle component to control a device that has seperate on and off inputs
and has an is-on output.
If in changes states via the toggle output
If is-on is true then on is false and off is true.
If is-on is false the on true and off is false.


sorry if my comment I was upset a little ... but ... if then else or and not I think is boolean basic math not only c code ... more English is not my language .... so use the code it seems to me better.

Anyhow ... now you are solved the question??

regards
giorgio

Please Log in to join the conversation.

More
9 years 8 months ago #87705 by BigJohnT

Please Log in to join the conversation.

More
9 years 8 months ago #87723 by jensor
Replied by jensor on topic toggle2nist description
I used: forum.linuxcnc.org/47-hal-examples/13201...-hold-resume-buttons

I found that after pausing, 1st depress of the run/step button, the unit finishes the line of Gcode it is on, pauses, depressing it again would advance 1 step, pressing it again would not step, but make is-on change state then the further presses did nothing. pressing resume/pause at this point does resume properly.

Please Log in to join the conversation.

More
9 years 8 months ago #87724 by andypugh
Replied by andypugh on topic toggle2nist description
I tried to put in tags for you, but they don't seem to work.

Please Log in to join the conversation.

More
9 years 8 months ago #87753 by bkt
Replied by bkt on topic toggle2nist description

I found that after pausing, 1st depress of the run/step button, the unit finishes the line of Gcode it is on, pauses, depressing it again would advance 1 step, pressing it again would not step, but make is-on change state then the further presses did nothing. pressing resume/pause at this point does resume properly.


Ok is more clear for me .... because I have the same problem ... (very rarely but I have) ... so the next week I try to understand the problem better.

Reagrds
giorgio

Please Log in to join the conversation.

More
9 years 8 months ago #87779 by BigJohnT
Replied by BigJohnT on topic toggle2nist description

jensor wrote: I used: forum.linuxcnc.org/47-hal-examples/13201...-hold-resume-buttons

I found that after pausing, 1st depress of the run/step button, the unit finishes the line of Gcode it is on, pauses, depressing it again would advance 1 step, pressing it again would not step, but make is-on change state then the further presses did nothing. pressing resume/pause at this point does resume properly.


I'll have to take a look at it, the code was provided by someone else and I only use Run and Pause/Resume no single step.
Code:
# External Program Pause/Resume Button net pause-resume-btn and2.3.in0 and2.4.in0 <= hm2_5i20.0.gpio.029.in_not net pause-on toggle2nist.0.is-on and2.3.in1 <= halui.program.is-paused net run-status and2.4.in1 <= halui.program.is-running net pause-sig or2.5.in0 <= and2.3.out net resume-sig or2.5.in1 <= and2.4.out net toggle-ok toggle.0.in <= or2.5.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

JT

Please Log in to join the conversation.

More
9 years 8 months ago #87787 by jensor
Replied by jensor on topic toggle2nist description
The file you posted is identical to what I have and for Run/Pause works flawlessly. However the Run/Step function sometimes works perfectly, other times gets hokey and you have to hit the Run/Pause alternately with Run/Step to get it to step.

Jensor


Attachment not found

Please Log in to join the conversation.

Time to create page: 0.108 seconds
Powered by Kunena Forum