LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Trouble taking data from event structure

Solved!
Go to solution

Hello, I'm trying to build a producer consumer loop. 

 

My issue comes when I want to take the value of some buttons I am displaying on front panel. I don't know how to use the data onto the other loop.

 

Blancoys_0-1649796533228.png

 

My attempt is to use it to compare on the consumer loop, however I don't know how to transport this down there. 

Blancoys_2-1649796667760.png

 

General Picture: 

 

Blancoys_3-1649796692847.png

 

 

 

Any suggestions are welcome. 😋

 

 

 

 

0 Kudos
Message 1 of 7
(1,122 Views)
Solution
Accepted by topic author Blancoys

Instead of using a queue with just a command enum, make it a cluster with a command enum and a variant. Then you can send whatever you'd like to your other queue. You'd of course need to convert it back from a variant, but you'll always know what type it is ahead of time anyway.

Message 2 of 7
(1,115 Views)

Is this what you suggest?

 

Blancoys_0-1649799713761.png

 

How do I input the data in the variant? do I have to unbundle it too?

 

0 Kudos
Message 3 of 7
(1,100 Views)

You already do the compare in the consumer loop, right?

If you want to do the compare in the event loop, use event data nodes for new value and old value.

altenbach_0-1649800009835.png

 

You really need to rethink your approach to the entire program. adding piles of complication does not make the program better by any definition.

 

Some more comments:

  • Loop.vi: Your loop VI should only have one input. The constant belong inside the subVI as diagram constants.
  • checkbutton.vi: the -1 exception belong inside the subVI.
  • trnasaction.vi: Get rid of that refernce and property node. Pointless. Find a logical terminal layout. This is NOT it!

altenbach_1-1649800374993.png

 

Message 4 of 7
(1,093 Views)

@Blancoys wrote:

Is this what you suggest?

 

Blancoys_0-1649799713761.png

 

How do I input the data in the variant? do I have to unbundle it too?

 


Use a "Bundle" node, wire your data into the Variant input. LV will convert it to variant automatically, but you'll have to use Variant to Data to convert it back to usable data. Tip, do this inside the specific instruction's loop. This way each instruction can have its own data types.

Message 5 of 7
(1,078 Views)

I did the changes as suggested and it works properly! I will clean up the code and upload it 😀

 

 

As always, Thank you for your time 🐞

0 Kudos
Message 6 of 7
(1,063 Views)

i had the same problem as you and it worked for me if you still get the error but don't know how to follow me for instructions

0 Kudos
Message 7 of 7
(1,033 Views)