lenny wintfeld Posted December 18, 2008 Report Share Posted December 18, 2008 Hi, I've been teaching myself labview using Travis/Kring's "Labview for Everyone" and I have been making excellent progress on my own so far. I'm stuck, though, with one of the example VI's: "Disable All Controls While Busy.vi" from chapter 15. It's attached along with my version "Disable all while run.vi". The example uses what appears to be a reference to an array of generic control to intialize the shift register in the first frame of the flat sequence structure. I have been unable to re-create that initializer object. If you look at my version of the code, you'll see that I tried to do an equivalent initializer as a class specifier constant and set it to "Control" using popups: Select VI Server Class->Generic->GObject->Control->Control. This object is wired to a "build array" object. If I wire these to the shift register and run the VI, the third frame generates "Error 1055 occurred at Property Node in Disable all while run.vi" with a reason of "Object reference is invalid". My questions are: 1. How do I create the intialization object shown in the "Labview for Everyone" example program. And as an aside, how would I get labview to describe that "thing" to me? 2. The object I created has the same type as the "Labview for Everyone" object (both are a "1D array of Control Refnum"). But based on the error message, mine has nothing that it refers to. What does the "Labwview for Everyone" object refer to? 3. In my version of the progam with the object that causes the problem not wired into the shift register at all (e.g. just "floating") the program runs just fine! Am I just lucking out with an unitialized shif register? If not, what is the purpose of the initialization object? Thanks in advance for any advice? Lenny Wintfeld Quote Link to comment
jdunham Posted December 18, 2008 Report Share Posted December 18, 2008 QUOTE (lenny wintfeld @ Dec 17 2008, 02:41 PM) I've been teaching myself labview using Travis/Kring's "Labview for Everyone" and I have been making excellent progress on my own so far. Welcome to LabVIEW! QUOTE (lenny wintfeld @ Dec 17 2008, 02:41 PM) 1. How do I create the intialization object shown in the "Labview for Everyone" example program. And as an aside, how would I get labview to describe that "thing" to me? The easiest way is to pop up on the shift register -> Create -> Constant. You can also drop an empty array constant from the array palette, then drop the control ref constant inside it (you can also drag it back out of the existing one to see the empty array constant) You can also use the "initialize array" function with no size input (length=0) to get an empty array. That's what I usually do. If you have the wiring tool on, and the context help window open, it will tell you the data types of each wire when you hover over it with the cursor. That's how you figure out what the differences are. QUOTE (lenny wintfeld @ Dec 17 2008, 02:41 PM) 2. The object I created has the same type as the "Labview for Everyone" object (both are a "1D array of Control Refnum"). But based on the error message, mine has nothing that it refers to. What does the "Labwview for Everyone" object refer to? Using Build array puts one element into your array, but it's basically a NULL reference not pointing to any particular object. Your downstream functions are complaining about that. QUOTE (lenny wintfeld @ Dec 17 2008, 02:41 PM) 3. In my version of the progam with the object that causes the problem not wired into the shift register at all (e.g. just "floating") the program runs just fine! Am I just lucking out with an unitialized shif register? If not, what is the purpose of the initialization object? Well you can drop an Array Size function on that array see what happens. You should notice that the array size grows forever; it's a memory leak. You don't notice any effect because that array is filled with redundant control references. When you disable the same control 400 times, it's still disabled. Quote Link to comment
lenny wintfeld Posted December 19, 2008 Author Report Share Posted December 19, 2008 Thanks *VERY* much! All your replies were right on. I tried each of the methods you described and learned a lot from that. Also tried disconnecting the Ctl object in the TRUE case and then creating a constant at the input shift register. Result was constant array with no type and a "void" wire since the compiler didn't know the type of connection ... all of which was expected. One thing I'll have to get used to is that the program retains state between successive runs. There isn't a clear distinction between the launcher and the debugger. Anyway thanks again. I'm sure I'll be back with more things I can't figure out. Lenny Wintfeld QUOTE (jdunham @ Dec 17 2008, 06:15 PM) Welcome to LabVIEW!The easiest way is to pop up on the shift register -> Create -> Constant. You can also drop an empty array constant from the array palette, then drop the control ref constant inside it (you can also drag it back out of the existing one to see the empty array constant) You can also use the "initialize array" function with no size input (length=0) to get an empty array. That's what I usually do. If you have the wiring tool on, and the context help window open, it will tell you the data types of each wire when you hover over it with the cursor. That's how you figure out what the differences are. Using Build array puts one element into your array, but it's basically a NULL reference not pointing to any particular object. Your downstream functions are complaining about that. Well you can drop an Array Size function on that array see what happens. You should notice that the array size grows forever; it's a memory leak. You don't notice any effect because that array is filled with redundant control references. When you disable the same control 400 times, it's still disabled. Quote Link to comment
Jim Kring Posted December 19, 2008 Report Share Posted December 19, 2008 QUOTE (lenny wintfeld @ Dec 17 2008, 02:41 PM) I've been teaching myself labview using Travis/Kring's "Labview for Everyone" and I have been making excellent progress on my own so far. I'm stuck, though, with one of the example VI's: "Disable All Controls While Busy.vi" from chapter 15. It's attached along with my version "Disable all while run.vi". Hi Lenny, I'm happy that you're making progress in learning LabVIEW with LabVIEW for Everyone and that you found the LAVA forums Cheers, -Jim Quote Link to comment
asbo Posted December 20, 2008 Report Share Posted December 20, 2008 QUOTE (lenny wintfeld @ Dec 18 2008, 11:57 AM) One thing I'll have to get used to is that the program retains state between successive runs. There isn't a clear distinction between the launcher and the debugger. This is both a blessing and a curse -- it allows for some neat functionality (functional global variables, for one) but can be bewildering if you don't keep in mind that it's happening. However, if you change your block diagram or front panel in between executions, LV will reset those shift registers. Quote Link to comment
Yair Posted December 21, 2008 Report Share Posted December 21, 2008 QUOTE (asbo @ Dec 19 2008, 05:12 PM) However, if you change your block diagram or front panel in between executions, LV will reset those shift registers. Or you can press Ctrl+Run, which force compiles the VI (with the side effect of clearing SR data). Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.