07-05-2019 05:15 AM
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.
07-05-2019 05:43 AM
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.
07-07-2019 01:50 PM
Here is a Snippet of the OP's routine (the VIs shown as question marks are routines from BK Precision 85XX instruments).
4 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
07-08-2019 03:06 AM
@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!
07-08-2019 03:27 AM
Thanks for your guys reply! Appreciate!
07-08-2019 07:17 AM
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
07-08-2019 07:25 AM
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.