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: 

Notifier - for loop

Solved!
Go to solution

The Event structure should be inside the case structure.

 

Disable and enable buttons is "just" part of your code, there are not specific examples for that.

0 Kudos
Message 41 of 60
(1,603 Views)

I found myself in a crossroad.

 

I have three different ways I can implement my code, but I don't know which can be better for my purpose.

 

I have a sequential program, where 2 parallel processes runs, at certain moment, one process have to wait each other to continue.

 

Which of these structures could be better?

 

1)controlling the processes and user button with a queue handling event?event-Message_Handling.png

 

2)by a having a event structure inside different cases.EventDriven.png

 

3) having diffente cases inside a event structure (where all is in the default event, but for others send them to the different cases)EventDrivenState.png

 

and in all of the cases, should I use the value (signal) element to trigger my processes from events?

0 Kudos
Message 42 of 60
(1,597 Views)

Just to add:

 

I have 4 events:

 

2 triggered by UI (start and Stop) and 2 triggered by reg event callback ( motor process and laser process).

0 Kudos
Message 43 of 60
(1,584 Views)

 


@dkfire wrote:

The Event structure should be inside the case structure.

 

Disable and enable buttons is "just" part of your code, there are not specific examples for that.


I read that creating an event structure inside a case structure should be avoided.

 

http://zone.ni.com/reference/en-XX/help/371361K-01/lvhowto/event_struct_outside_loop/

0 Kudos
Message 44 of 60
(1,552 Views)

Yes there is canvas on having the Event Structure inside a case structure in a while loop.

But if you design correct and you do not use the "Lock Front panel" option on events, then you can have the Event structure in a case.

 

But I would go for your option 1.

0 Kudos
Message 45 of 60
(1,538 Views)

Ok, but instead of Queue I think Notifiers are better (after all I don't need to queue values, only use them once).

 

The problem is how I send a notification inside a FOR loop, and then receive another notification inside it.

0 Kudos
Message 46 of 60
(1,509 Views)

@Stavrosyt wrote:

Ok, but instead of Queue I think Notifiers are better (after all I don't need to queue values, only use them once).

 

The problem is how I send a notification inside a FOR loop, and then receive another notification inside it.


You have a whole lot of people telling you the best way to do these things, but you're not listening. You've had some really talented, wizards give you advice in here and the other threads.

 

There are right ways and wrong ways to do things, not because they can't work a certain way, but because if you do them the right way from the start, then you are less likely to run in to problems in the future as you scale your application. All of LabVIEW follows dataflow, so you can't expect to see an event structure triggered when you haven't looped back to it again.

Cheers


--------,       Unofficial Forum Rules and Guidelines                                           ,--------

          '---   >The shortest distance between two nodes is a straight wire>   ---'


0 Kudos
Message 47 of 60
(1,461 Views)

@James.M wrote:
You have a whole lot of people telling you the best way to do these things, but you're not listening. You've had some really talented, wizards give you advice in here and the other threads.

 

There are right ways and wrong ways to do things, not because they can't work a certain way, but because if you do them the right way from the start, then you are less likely to run in to problems in the future as you scale your application. All of LabVIEW follows dataflow, so you can't expect to see an event structure triggered when you haven't looped back to it again.


What do you mean I am not listening? Words are just words, I need examples, templates, but not in general way, but something concrete within my problem.

 

can you give me an example how can I trigger an event inside a FOR loop for each FOR iteration?

0 Kudos
Message 48 of 60
(1,427 Views)

Hi Stavros,

 

What do you mean I am not listening?

You have been told not to program deadlocks.

You have been told to read the LabVIEW help.

You have been told to not use long-running loops within event cases (as is also written in the LabVIEW help).

 

LabVIEW comes with a lot of example VIs. Have you studied them?

NI provides a lot of beginner courses. Have you taken them?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 49 of 60
(1,420 Views)

Hi GerdW.

 

It's not that I am not listening there, it's just a matter of finding a solution and trying. Having a mistake doesn't mean I don't listening.

 

I read the LabviewHelp,I am not trying to use long-running loops in event cases. I need the for loop for reading data, and a event case for triggered events, it's not my fault that I needed both. What I need it's a way to not implemented in a wrong way.

 

of course I studied them and take some courses, but I am running out of time, and need to fix this problem ASAP.

 

I am not trying to build a mega project here, just to solve a specific problem, then I can continue taking courses and improving my DATAFLOW-thinking...

0 Kudos
Message 50 of 60
(1,387 Views)