LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

SIngle Push Button toggle

I understood what you said... I will take care of it in future...  :)) ppl learn from there mistake.

 

Yes!! I want what ever you said.... That is my requirement. Can you guide me on that. 

0 Kudos
Message 11 of 18
(3,899 Views)

This snippit is a start:

 

LED_Control.png

 

This will toggle the any LED whose corresponding input bit is 0 when the Send button is pressed.  Input bits with 1 do not toggle the corresponding output LED.  Now for your problem, you show that input bits D7, D6, and D5 are always 0.  You need to OR the input control in my VI with 0b11100000 to set these bits to 1 so that the outputs don't toggle, if that is what you want.  Also, I think your LED control requires a 1 to turn the LED off and a 0 to turn it on.  If this is the case, you need to invert the output bits.  Just run it through a NOT function.  You had a timed loop in your first VI.  If needed, add it in.  My example is tailored for just a specific part of your requirement.

I hope this finally helps.

Ooops, I almost forgot.  The True case just has a wire from input terminal to output terminal, no action takes place.

 

Message Edited by tbob on 03-31-2010 01:49 PM
- tbob

Inventor of the WORM Global
0 Kudos
Message 12 of 18
(3,888 Views)

Hi Rag,

 

I think that your problem has already been solved but i thought i might post a 'Toggle' Vi i wrote for a project as its simple to add to any code and may be useful to you:

 

Boolean Toggle.png

 

This is the Toggle subvi, and below is how you would use it in a VI (Ignore the panel reference, this was added by Labview when creating a snippet):

 

Boolean toggle example.png

 

The subvi basically just toggles the output using the boolean input.

Message Edited by Lucither on 04-05-2010 08:02 AM
------------------------------------------------------------------------------------------------------
"Everything should be made as simple as possible but no simpler"
Message 13 of 18
(3,853 Views)

You guys know that XOR is the equivalent to a toggle switch?

 

If you have a boolean value XOR'd with True, it toggles the boolean to its opposite state.  If the boolean value is XOR'd with False, it leaves it alone.  No need for the select function.

Message 14 of 18
(3,845 Views)

Ha, Good point Ravens. Funny but thats how i write it nearly everyday in 'C' but for some reason it completely slipped my mind in Labview. Good to have a fresh set of eyes. Smiley Tongue

 

Have adjusted accordingly, Thanks

 

Boolean Toggle xor.png

------------------------------------------------------------------------------------------------------
"Everything should be made as simple as possible but no simpler"
0 Kudos
Message 15 of 18
(3,842 Views)

Here are two ways to implement a toggle function using feedback nodes. The first one may be used from an unlatched source such as an I/O channel or a button on a joystick. The second one requires a latched source.

 

ToggleDemoBD.png

0 Kudos
Message 16 of 18
(2,322 Views)

More than the solution, the timing is amazing... i started this thread in April 2008 and here we are with one of a solution after 8 years !!

 

The NI Forum must be running on a HUGE server to host this kind of a callback of old threads .. Smiley Very Happy

Raghunathan
LabVIEW to Automate Hydraulic Test rigs.
0 Kudos
Message 17 of 18
(2,305 Views)

Lucither,

 

Your subvi is the solution to a problem I've been struggling with for 2 days now, thank you!

0 Kudos
Message 18 of 18
(1,520 Views)