LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Update new values into while loop

Hi guys,

Thanks for looking over here.

I'd like to put a 'reload' button to reload some new parameters when the while loop is running. Basically when after running the whole program, the values will change if I press that 'reload' button.

Don't know how to do that and already tried to put an event structure into my while loop somehow that doesn't work.

Here I attached the VI.

THANKS ALL.

0 Kudos
Message 1 of 7
(2,931 Views)

Can't look at the code (it's LV19, quite new), but I can guess.

 

An event structure will block execution if there's no event. So it's not a plug and play solution...

 

You can use an event structure in a loop, but it needs to be the top level. What you have now needs to be in a 2nd loop, or started from within the event structure. It will be a process controlled by your new main VI...

 

You might need to dig into architectures, like (queued) state machines, producer\consumer and such.

Message 2 of 7
(2,912 Views)

Here is a Snippet of the OP's routine (the VIs shown as question marks are routines from BK Precision 85XX instruments).

4 Modes4 Modes

I agree with Wiebe that the OP needs to learn some more advanced LabVIEW Design Patterns to do all of the "fancy" things.  Another thing you should learn about are Enums -- instead of making Mode of Operation a 16-bit unsigned integer taking on the values 0 .. 3, yu can make it an Enum that takes on values CC, CV, CW, and CR, which avoids "magic numbers" and makes the code more intuitive.

 

Bob Schor

Message 3 of 7
(2,864 Views)

@Bob_Schor wrote:

Another thing you should learn about are Enums -- instead of making Mode of Operation a 16-bit unsigned integer taking on the values 0 .. 3, yu can make it an Enum that takes on values CC, CV, CW, and CR, which avoids "magic numbers" and makes the code more intuitive.

 

Bob Schor


Don't forget to mention type defs. When making that enum, better make it a type def!

Message 4 of 7
(2,846 Views)

Thanks for your guys reply! Appreciate!

0 Kudos
Message 5 of 7
(2,836 Views)

wiebe@CARYA wrote:

Don't forget to mention type defs. When making that enum, better make it a type def!

Absolutely!  I make a lot of TypeDefs -- every Enum and Cluster that I create gets a TypeDef, which means that when I need to change it (and I usually change at least 50% of the TypeDefs during the development of a complex or large routine), I change it one place and then find where they are used and update the VIs to reflect the changes.

 

Bob Schor

Message 6 of 7
(2,825 Views)

My 'clusters' are always in a class's private data. In a way, that still counts as type def's (, but with benefits).

 

I hardly have traditional type def's anymore... The few that remain, are exclusively enums.

0 Kudos
Message 7 of 7
(2,817 Views)