LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Assign value only if button is down

Hi !
What I want to do is:

If my (latch) button is pressed, then and only then assign a value to
an indicator.
So I need a button which, if pressed, "let's a value through" to my
indicator.
Is this possible ?

Thank you very much in advance,
Daniel
0 Kudos
Message 1 of 6
(3,437 Views)
Use case structure with button as selector
Look attached example
0 Kudos
Message 2 of 6
(3,437 Views)

Hi All,

I know this post was quite some time ago but looking for help on a variation that seems to be very close I'm stuck on.

I was looking for how to assemble a block diagram so as a button could push a numeric value (int) out to a variable or indicator.

Example would be for a button when clicked to set a value of 2 out to the I/O field.  Beyond that I was hoping to have a few buttons to each do a unique value, 2, 3, 4, and so on.  I find the Boolean crossing doesn't give me the one-shot capability I thought might work.  I am also stuck on the CASE simply allowing only a TRUE case and void/ignore the FALSE case.  Is there a null or something I could put in the FALSE case?

 

Sorry for the different questions, I am pretty new to LabVIEW (using 2017).  I have programmed many GUI/HMI on other platforms as well as C/C++ background so looking to make correlations for help my learning curve.

 

Thanks Community!

PlumPine

0 Kudos
Message 3 of 6
(1,770 Views)



@PlumPine wrote:

I find the Boolean crossing doesn't give me the one-shot capability I thought might work.


Sounds like you should be using an Event Structure.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 4 of 6
(1,761 Views)

Many good LabVIEW practices will look and feel different from things you've learned for text-based coding.  Use the training resources at the top of the LabVIEW forum page and experiment with examples (but don't save your changes unless you "Save As" to a new location!!!).  A couple other brief tips:

 

1. If you find yourself reading from local variables and writing the result to other local variables, then LabVIEW-wise you're "doing it wrong".  Data wants to flow through operations and functions on *wires*.

 

2. LabVIEW inherently wants to run everything it can in parallel unless you structure your code to prevent it.  That structure will mostly be wire connections representing data coming out of one operation and into another.  This data dependency is used to force execution sequence.  If there is no data dependence between various sections of the code, they're all free to run at the same time.

 

3. Fellow forum member billko sums up LabVIEW's dataflow paradigm very nicely: "A node executes only when data is available at all of its input terminals and supplies data to the output terminals only when the node finishes execution."

    If you apply that rule rigorously and make no further assumptions about execution order, you'll be able to interpret a LabVIEW program to understand what executes in parallel and what's forced to execute in sequence.

 

I whipped up a really simple example with an event structure and boolean buttons set for latching action.  See if you can understand it, then follow up with the other training and knowledge resources.

 

 

-Kevin P

ALERT! LabVIEW's subscription-only policy came to an end (finally!). Unfortunately, pricing favors the captured and committed over new adopters -- so tread carefully.
Message 5 of 6
(1,740 Views)

Kevin_Price,

Thank you kindly for that terrific yet simplistic example to provide me some insight!  Whilst you were formulating that I was also continuing to follow examples and experiment to nearly an outcome I was hoping for.  I did indeed utilize an Event Structure for each of my buttons to which I wanted unique number assignment fed through to a separate CASE Structure (one case per button).  For each button the "magic" I found came in the form of the Create>Property Node>Boolean Text>Text allowing me to define the numeric I wished the button to 'force" through for any particular button press (setup as Latch When Released) establishing a change to a singular value(variable).  Next steps are to follow to utilize the global variable and also see about the Event Timeout which I see functioning in your example but find it breaks mine when assigning the constant of 2000 for some odd reason.

Again, Thank you immensely for the time to help provide me some guidance and some def Kudo stars for you!

 

Regards,

PlumPine

0 Kudos
Message 6 of 6
(1,727 Views)