From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Event Structure

Solved!
Go to solution

I have an event structure with only one event case, the value change in "load " button. I have say A to F, 6 controls inside the event structure in this only event case. the idea is to change the values of A to F as much as times I need and press load button, so that the final set of values gets passed to the next stage. but when the program reaches the event structure when I click any of the 6 controls, the front panel freezes. the structure fails. whereas if I click 'load' first whatever value A to F are holding as passed on, I mean the event case works. why does this happen? and this is a state machine using case structure and I have the same A to F and the load button in another event structure in another state. but it won't affect, right? 

0 Kudos
Message 1 of 15
(3,332 Views)

Please post your VI.

Having multiple event structures in a single VI is a VERY BAD idea for new LV developers. And you are incorrect: In 'inactive' (read: in an inactive case of a case structure) event structure still enqueues events.

Also, by default event structures lock the front panel when a FP event is handled so it very much likely be an expected behavior that you are seeing.

 

Lesson learned: Use a single event structure. If you need something concurrent (parallel running) to the events, use a producer/consumer design.

Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
0 Kudos
Message 2 of 15
(3,309 Views)

Hi balanunni,

 

but when the program reaches the event structure when I click any of the 6 controls, the front panel freezes. the structure fails. … why does this happen?

Because you made something wrong…

Most probably you used the event structure in a wrong way preventing it from executing when needed!

To get more recommendations you should attach your VI or a snippet of the BD.

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 3 of 15
(3,308 Views)

@gerd: I think this is key:


@balanunni wrote:

[...] and I have the same A to F and the load button in another event structure in another state. but it won't affect, right? 


As i said, works as expected (without seeing the actual code that is)....

Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
0 Kudos
Message 4 of 15
(3,300 Views)

I cannot attach the VI, it has a lot of confidential things related to the work am doing in my company. The VI is basically built to interact with an FPGA using UART. I have built it a s a state machine. It has two modes, one where the whole A to F controls can be changed and when I click the "load" button the packet will be sent to FPGA. In second mode, the control inputs will be send individually (like if the user wants to change only two inputs he will make change in the two controls among A to F)  in a packet structure which has a parameter id which will help the FPGA to identify Which control it is. Event structures are used in both cases. in first case, once the required changes are made, I hit the load button and the whole A to F values go as a concatenated string in the preset packet structure. In the second mode I have made an event structure INSIDE a while loop with event cases for each controls A to F and the load button. the load button case has a true Boolean constant wired to while loop terminal. Each control case has its own parameter id and dec to hax conv, making string. once any of the button (A to F) gets clicked, the entered value gets converted to string with the corresponding parameter ID. The second mode is working as expected. but the first one is not. 

0 Kudos
Message 5 of 15
(3,291 Views)

Hi balanunni,

 

so you made the error of creating atleast two event structures in the same VI.

Then you made the error of configuring the same event in both event structures!?

 

Please read the LabVIEW help on "caveats" of the event structure - and follow the recommendations given there!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 6 of 15
(3,283 Views)

I merged the both the event structures. Now its working. But I am supposed to make an exe from the project file. so I had to put a while loop above all the structures in block diagram and provide a stop button. But after doing that the VI will run for the first time, no error, or glitches. when the second time it starts, front panel is freezed. Smiley Mad

0 Kudos
Message 7 of 15
(3,268 Views)

Hi balanunni,

 

back to message #3: attach your VI - or debug on your own…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 8 of 15
(3,258 Views)

@balanunni wrote:

[...] when the second time it starts, front panel is freezed. Smiley Mad


You have placed the stop button terminal in its event case?

You have properly closed down all resources before stopping the VI in your code?

Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
0 Kudos
Message 9 of 15
(3,254 Views)

If your actual VI has a lot of confidential stuff, make a copy of it, strip out all of the Confidential Stuff (replace it with a much-simplified suggestion of what you are doing, e.g. a Text Box that says "Save Data to File" or "Enable Front Panel Controls") and attach the simplified VI (attach the actual VI, since we may need to execute it to see why it is failing for you).

 

How much help would you be to me if I came to you with a two-page listing of a Matlab program that didn't work, but said "Sorry, I can't show you the code, wear this blindfold, but tell me why it doesn't work"?  Without seeing the code, or at least the structure of the code, we can only guess (but can say "you are doing something wrong").

 

Bob Schor

0 Kudos
Message 10 of 15
(3,235 Views)