07-03-2002 10:07 AM
07-03-2002 10:34 AM
09-13-2022 01:09 PM
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
09-13-2022 01:42 PM - edited 09-13-2022 01:43 PM
@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.
09-13-2022 04:32 PM
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
09-13-2022 05:35 PM
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