LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Help Required

Hi,

 

I am using LV 8.6. I am stuck with some issue related to events. I am using a menu called "Test" in my application. Under "Test", I have "Run","Stop","Pause" menu items.I am creating this menu in run time in my application. When I click "Run", my tests will start.My test consists of the following steps:

 

1. I have to poll for some switch action

2. if it is as expected then i have to wait for some time, say 1hour.

3. Then I have to send some range of frequencies to the UUT and read back the signal from DMM/Counter for each frequency.So I have kept this in while loop.(I have total 32 UUTs, Step 2 has to be repeated for all the user selected ones.)

4. I have to poll for some switch action,

5. if it is as expected then i have to wait for some time, say 1hour.

6. Same as Step 2.

 

while performing the above actions if the user clicks "Stop", then my tests should stop. For "Pause", i should be able to hold the tests in the same state and then should be able to continue from the same point in the future.

 

I am using case structure for handling menu events. From "Get Menu User Selection VI", i am reading the user selected menu item and executing that particular structure.Here i am facing issue.When I am inside the "Run" case, if user selects "Stop"/"Pause", Stop/Pause case is executing only after the "Run" case is completed. What I understood is after every step in my test , i have to continuously poll for the menu selection. But I am not getting how to implement this in my code.  Because I have one case structure ( with one while loop outside ) for handling all my menu items. If Inside "Run" case, for each step if i have poll for the menu item means again i have to keep one more case structure then it will become a mess...

 

Can any one suggest what will be the better approach to handle this..... Any help will be greatly appreciated..

 

Thanks,

Harika

0 Kudos
Message 1 of 5
(2,764 Views)

Hi harika,

What you can do is,pass reference of Pause and Stop buttons inside Run case.Hopefully you are running a subvi inside it.

If yes, then you can access events(of pause and stop) inside that subvi.

Place a event structure and you can pause and stop execution.

 

 

Best of LuckSmiley Happy

Gaurav k
CLD Certified !!!!!
Do not forget to Mark solution and to give Kudo if problem is solved.
0 Kudos
Message 2 of 5
(2,753 Views)

Hi Gaurav,

 

Thanks for your suggestion. But unfortunately i didnt understand clearly what u r trying to explain.

 

I got an idea of using "State Machine Architecture" for this scenario. Please let me know whether this approach works fine.

 

Thanks,

Harika

0 Kudos
Message 3 of 5
(2,746 Views)

Yes harika state machine architecture will solve your problem.

About what I said in the last post: if you did not understand, Check the example code attached with this post. This will show you how you can access

events of main vi into sub vi. I don't have time to do it properly.But it will definitely give you an idea.

Gaurav k
CLD Certified !!!!!
Do not forget to Mark solution and to give Kudo if problem is solved.
0 Kudos
Message 4 of 5
(2,737 Views)

Yes you can go for the State machine arcitecture, use the notifiers for getting the events and you can use a parallel loop to execute the acquisition etc.,

 

Smiley Wink

-----

The best solution is the one you find it by yourself
0 Kudos
Message 5 of 5
(2,736 Views)