LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Help please : on/off switch

Solved!
Go to solution

Hi eveybody, 

 

I have problem with my programm.. 

 

I would like that my case "scenario_en_cours" be turned on or off and if it's "off" to change on different tabbed. 

 

Can someone help me please ? 

 

Cordially

0 Kudos
Message 1 of 10
(2,987 Views)

The terminal for the tab control (Commande onglets) is in the outer loop. The only time that is read is when all the code in the current case has completed.  That only happens when Stop_scenario has been pressed and the bottom while loop in "scenario_en_cours" has received the  "Ecriture_gradient"  command via the queue. Tha only appears to occur in the "rampe" case of the for loop.

 

I cannot tell what cases occur when, so it is difficult to see what is happening. It is possible that pressing Stop_scenario will cause the upper two loops to stop with the lower loop in some other case. That could leave the event structure with the Stop_scenario Value change event queued up but not executing because the case structure is in a different case.

 

This whole progam should probably be re-configured to to use a Producer/Consumer Architecture. Use only one event structure for the program - in the Producer loop. The Consumer loop would implement a state machine. Most likely this would eliminate the need for the nested loops, the local variables, and the Value property nodes. The number and distribution of the Wait functions seems awkward and likely to make the timing different from what you really want.

 

Lynn

Message 2 of 10
(2,956 Views)

Thank you for help Lynn !

 

Can you show me example with Producer/Consummer Architecture please ? 

 

 

0 Kudos
Message 3 of 10
(2,941 Views)

There are examples in all recent versions of LV.

 

New... >> VI >> From Template >> Frameworks >> Design Patterns >> Producer/Consumer (Events).

 

Lynn

Message 4 of 10
(2,933 Views)

Can I use event structure in Producer loop for tab control ? 

 

I need to use event loop in Consumer loop too, but it's not very good ? 

0 Kudos
Message 5 of 10
(2,919 Views)
Solution
Accepted by topic author aznnath11

You only need one event structure. More than one usually creates more problems than it solves. The Producer sends messages via the queue to the consumer telling the consumer what happened, for example, a tab change. You cnause the event structure for anything the use changes on the front panel, buttons, tabs, string or numeric controls, as well as other things. For your program mostly buttons and the tab control will have event cases. You do not care when the Gradient value changes but want to read it and other controls when the rampe button is pressed.

 

Lynn

Message 6 of 10
(2,914 Views)

Thank's for help Lynn, I understand what you tell. I think it would be better like this !

0 Kudos
Message 7 of 10
(2,909 Views)

I have made these changes, but it can't work..

0 Kudos
Message 8 of 10
(2,867 Views)

There are so many loops and they are all stopped using the one stop button.  That will make it appear like your program is not working but in reality, the execution is stuck in one of these loops waiting for you to push the stop button.

aputman
------------------
Heads up! NI has moved LabVIEW to a mandatory SaaS subscription policy, along with a big price increase. Make your voice heard.
0 Kudos
Message 9 of 10
(2,823 Views)

You still have two event sttructures. If the one in the lower loop has an event queued up when the loop is in one of the other cases, the program may never stop.  The lower loop should not have an event structure and probably does not need any nested loops.

 

Lynn

0 Kudos
Message 10 of 10
(2,804 Views)