LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to read String control with a delay inside the Event structure

I thought you changed to a case structure, but you still have 3 event structures, each trapped inside one case of a case structure. That's really bad!!

 

You don't need to hide the tabs 4 times per second forever. That needs to be done exactly once before the main loop (or zero times if they are already hidden). Are you really resetting a control to defaults 4 times per second, even if it is not needed?

 

You might want to rethink all that, and more... I think all this can be dramatically simplified. Try it!

Message 11 of 21
(700 Views)

 


@altenbach wrote:

I thought you changed to a case structure, but you still have 3 event structures, each trapped inside one case of a case structure. That's really bad!!

 

You don't need to hide the tabs 4 times per second forever. That needs to be done exactly once before the main loop (or zero times if they are already hidden). Are you really resetting a control to defaults 4 times per second, even if it is not needed?

 

You might want to rethink all that, and more... I think all this can be dramatically simplified. Try it!


Now I placed hide tabs in the main loop and removed the reinitialze function (Though I used it for another purpose by mistake I placed in this program). You said that, 3 event placed inside case structures are bad. What's the reason behind that ????? What happen if I do so???

0 Kudos
Message 12 of 21
(692 Views)

Vij@y wrote:

 


@altenbach wrote:

I thought you changed to a case structure, but you still have 3 event structures, each trapped inside one case of a case structure. That's really bad!!

 

You don't need to hide the tabs 4 times per second forever. That needs to be done exactly once before the main loop (or zero times if they are already hidden). Are you really resetting a control to defaults 4 times per second, even if it is not needed?

 

You might want to rethink all that, and more... I think all this can be dramatically simplified. Try it!


Now I placed hide tabs in the main loop and removed the reinitialze function (Though I used it for another purpose by mistake I placed in this program). You said that, 3 event placed inside case structures are bad. What's the reason behind that ????? What happen if I do so???


Did you even bother to click on the links I showed you before?  Apparently not, because it explains why you should stay away from placing more than one event structure in a loop.

 

I advise you to STOP CODING and learn how to code LabVIEW properly before proceeding ANY FURTHER.  It is painfully obvious that you have NO IDEA what you are doing.

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
Message 13 of 21
(672 Views)

Vij@y wrote:

 You said that, 3 event placed inside case structures are bad. What's the reason behind that ????? What happen if I do so???


Your code is very fragile and relies on hiding of controls to ensure that events cannot happen out of order. This is a very poor technique and does not scale well once the program gets a bit more complicated or if you need to make changes, and can lead to errors and lockups that are difficult to debug. An event structure does not rely on dataflow but will queue up event even if the code can never reach it (e.g. if it is trapped in a different case of a case structure). If this happens, the front panel will lock up forever. For example of you would manage to click a control twice at just the right moment, the second even cannot be handled and will accumulate forever.

 

A much more correct architecture would have the event structure almost outermost, only surrounded by the while loop. It would have all possible event cases.  For example, it would have an event for the task selector that would flip the tabs and events for all the buttons that would trigger the relevant actions. The event structure would be ready tro handle any event at any time. It would be much more straighforward and significantly less convoluted.

 

Try it!

0 Kudos
Message 14 of 21
(670 Views)

Hi Bill,

 

Thanks for your statement. Surely I ll study the link you mentioned. I am just new to labview and there is more to learn from this. I kindly request you to correct me in future, If I repeat such mistakes like this. 

 

 

 

 

0 Kudos
Message 15 of 21
(662 Views)

Hi Altenbach, 

 

Thanks for your suggestion. I ll brush up with the techniques thoroughly and will start implement this logic again. Though I m new to LV kindly guide me in future, If I repeat these mistakes again. 

 

 

 

0 Kudos
Message 16 of 21
(662 Views)

Just as a quick outline of a better architecture, see the attached quick modification (LabVIEW 8.2).

 

(I don't have your subVIs, so I simply replaced them with dialogs to show what is happening. You need to fil in the blanks)

 

Note that all buttons have been set to latch action. This way the reset to false automatically once they have been read by the code.

0 Kudos
Message 17 of 21
(655 Views)

Vij@y wrote:

Hi Bill,

 

Thanks for your statement. Surely I ll study the link you mentioned. I am just new to labview and there is more to learn from this. I kindly request you to correct me in future, If I repeat such mistakes like this. 

 

 

 

 


I just wanted to put the brakes on this before you coded so much stuff that it would be difficult, if not impossible, for us to sort through.  The reason why we need you to understand the basic concepts (besides the reason that you should just be a competent LV programmer) is to avoid situations like what we have here, where we are taking up time explaining basic stuff instead of solving your issue.

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 18 of 21
(649 Views)

@altenbach wrote:

Just as a quick outline of a better architecture, see the attached quick modification (LabVIEW 8.2).

 

(I don't have your subVIs, so I simply replaced them with dialogs to show what is happening. You need to fil in the blanks)

 

Note that all buttons have been set to latch action. This way the reset to false automatically once they have been read by the code.


Your code proven me how a Good architechture should be. I now understand my mistakes and will try to avoid such bad code...Smiley Wink Furthermore, This is what the solution I expect ! Thank u Altenbach 🙂

0 Kudos
Message 19 of 21
(639 Views)

I jus understand my mistakes Bill. Most likely I will never come up like this code again. Will review wiith the basic concepts and try to be a perfect programmer  Smiley Happy

0 Kudos
Message 20 of 21
(637 Views)