02-23-2009 12:35 PM
I have a problem with a LabVIEW 7.1 application I am developing. I have previously used LabWindows/CVI and am used to event-drivent programming. My application involves setting and reading data from about a dozen test instruments (all of different types), depending upon what the user wants to do. The diagram of the application is a While Loop with an Event Structure inside of it. The while loop runs until a "stop" button is pressed, and the event structure handles each different instrument. I initialize all the instrument settings outside the loop so that they have default values, but allow the user to change them as desired via one of the events.
When I first set up this application, I used Feedback nodes and it initially seemed to work ok, but as the application got bigger I ran into a problem where the values were reset to zero after every event. I figured that perhaps Globals would get around this, so I changed the structure to resemble the attached code (picture included for those who don't have LV7.1). However, now the problem is that the value change event doesn't actually change the values - they get reset back to the defaults every time.
Anyone have suggestions on how to fix this (or a better way to implement it)?
Thanks!
Michael Tracy
Synergy Microwave
Solved! Go to Solution.
02-23-2009 01:03 PM - edited 02-23-2009 01:05 PM
The problem is nothing is related to anything else.
You have 3 hidden controls of cluster, cluster1 and cluster2. You have a global variable of clusNumber.
When you start, cluster goes to clusternumber global
If you hit change Number SetNumber VI runs. All it does is take the controls you have set in the subVI and send it to cluster1.
Display settings takes cluster number2, unbundles the elements and sends it out to numeric 1, 2, and 3, all hidden indicators. That subVI does the unbundling as rapidly as possible until you hit stop on the subVI.
No where in the code do you assign values between the different clusters.
You must be very new to LabVIEW. I would recommend looking at the online LabVIEW tutorials
LabVIEW Introduction Course - Three Hours
LabVIEW Introduction Course - Six Hours
Ultimately what you will want is a single cluster that is carried through the iterations of the while loop by way of a shift register.
02-23-2009 01:04 PM
02-23-2009 02:12 PM
Thanks, Dennis - shift registers did the trick, but I had to wire each one through every event, whether it was being used or not.
To the other poster - the clusters are all derived from the Globals (if you right click on a global, you can create an indicator or control based on it, which I did and then renamed them), so I assumed (yeah, yeah I know, I saw the Odd Couple episode too) they would write to and read from the Global as current content. Yes, I am new to LabVIEW, having used it sporadically for a couple of months now. Although I've programmed in 6 different computer languages over close to 3 decades, that background didn't seem to help as much as I expected. 😉
Regards,
Michael Tracy
Synergy Microwave
02-23-2009 02:43 PM
HI Michael,
Before you go to far you may want to review the Nugget I wrote on Action Engines (they take advantage of the fact that a shift register acts a lot like a static local) becuase they are a way of encapsulating the Shift Register and using them wherever you want.
Re: having to wire all of the tunnels.
IN LV 8.5 there is an option assign tunnel pairs so they all get wired up automatically.
Ben