04-14-2008 09:36 AM
Which errors? The queue is obviously there to make sure that the bottom loop executes exactly just as often as the top loop! As such, there's no need to actually put any data into the queue, or read it. ![]()
(glad you didn't put my reply to this thing here as well...
)
04-14-2008 10:50 AM
JoeLabView wrote:
Can you find at least 8 errors in my previous post? Apart from the title...
04-14-2008 11:13 AM - edited 04-14-2008 11:15 AM
my bad..
.. at least 8 mistakes.. { including bad practices }
counting the ones you mentionned 😉
04-14-2008 11:15 AM
Actually, wiring a queue reference to a shift register is sanctioned by NI as a good thing. I took an intermediate class once, and the instructor told us to make it a habit to do this. His reasoning was that a For Loop can execute 0 times. If such happens and the queue reference was not wired to a shift register, the output on the queue ref wire would be NULL, causing errors on down the line. If wired to a shift register and the For Loop ran 0 times, the output would be a valid reference because the shift register was initialized. Of course this doesn't apply to While Loops which always execute at least once. The instructor said it was just good practice to get into the habit of doing this always. I've been doing so ever since.
altenbach wrote:
Here are a few more:
- queue wire in shift register.
04-14-2008 11:22 AM
Salut l'cousin (p'ti-bob),
04-15-2008 01:17 AM
Hi,
There was a problem with one of the LabVIEW versions (maybe 6.0) where a reference passing throughs through a loop was getting changed, corrupted or lost ( cant remember the exact problem). Anyway, the solution was to pass it via the shift register. Therefore I tend to use shift registers regardless.![]()
Regards
Ray Farmer
04-15-2008 01:32 AM - edited 04-15-2008 01:34 AM

04-15-2008 07:26 AM - edited 04-15-2008 07:28 AM
You could always put a Case Statement (around the For Loop) to handle an empty array 😉
But you'd still get an empty array for Keys... which wouldn't change much... 😞
I'm off cafeine... so the brain is now processing at half speed.
04-15-2008 07:36 AM - edited 04-15-2008 07:37 AM
Funny how this comes up...
Today, I encountered the situation that JB dscribes... Putting the reference into a shift register would have involved major rewiring, and far less easy to read code. So, I indeed choose the second option, where I put a case statement around it. (Actually, before the sub-VI got called).
In my case, it also made more sense to warn the user that he forgot to specify something, then to simply do nothing.
04-15-2008 01:36 PM
