07-17-2007 06:11 PM
@Radiance_Jon wrote:
PS - where in the heck are error in and error out?!?! I can't find them in the functions palette
07-18-2007 10:11 AM
07-18-2007 04:44 PM
07-19-2007 12:10 PM - edited 07-19-2007 12:10 PM

Message Edited by smercurio_fc on 07-19-2007 12:10 PM
07-19-2007 04:43 PM
07-19-2007 10:24 PM - edited 07-19-2007 10:24 PM
Primitive basically means the smallest form of a VI, (i.e. a simple function). Addition is a primitive as you can't open it up and look into. Right below addition on the Numeric pallete (at least on my screen) on the block diagram is a "+1". It does in a single node, what adding a constant 1 with an addition node does.
There are basically 3 types of ways to pass data into and out of loops.
Normal tunnel (a colored block), uses the same value at the beginning of each iteration even if that wire gets the data changed on it. The value at the end of the last iteration gets passed out.
Shift register (an downwards and upwards triangle which are paired up one each side.) This feeds the the value at the end of the last iteration to the beginning of the next iteration. (Similar to feedback nodes, but many people, including me, feel the shift register is easier to read)
Auto indexing tunnel. (square brackets [ ] ) Feed into an array, each iteration of the loop uses the next element of the array. The number of elements determines how many times the loop runs. When you autoindex going out of the loop, an array is built based on the number of times the loop is run.

The reason you don't want to autoindex the I/O reference or the error clusters is that you don't want to build arrays of them, but just pass the value back into the next iteration of the loop.
Message Edited by Ravens Fan on 07-19-2007 11:29 PM
07-19-2007 10:35 PM
When auto indexing multiple arrays, or having a value fed into the N node of a for loop, the loop only runs the number times based on the smallest value of N and the number of elements in the smallest array. If you had a 3 element array, but a value of N=4, the 4th element of the array is undefined, thus what would it use? It only ran 6 times because there was an array of 6 elements of VISA references built up in the first loop.
@Radiance_Jon wrote:
I'm not totally sure what you meant by the primitive incrementer. I found the error with the VISA resource name by chance. I used a similar loop later on and could not figure out for the life of me why it was only running 7 times instead of eight. Near as I can figure the VISA resource name was always auto-indexing, and I guess at an earlier stage there were only 6 elements, so future loops based their auto-indexing off of this instead of the arrays I was trying to index them off of.
07-26-2007 09:08 AM - edited 07-26-2007 09:08 AM
You need to replace the auto-indexing for the error cluster with a shift register for both the left and the right loops.
Message Edited by Radiance_Jon on 07-26-2007 09:09 AM
07-26-2007 10:34 AM
You can setup both the VISA resource and and the error wire with a shift register. The key thing for the VISA resource is that it is NOT an autoindexing tunnel that generates an array. For the VISA resource name, it won't matter whether it is a normal tunnel or a shift register and should behave the same. That's because the VISA resource name wouldn't be getting changed from one iteration to the next that would require it to be fed back in at the beginning of the loop.
Yes you can wire the "output" side of the shift register to the next VI in line.
With a normal tunnel and no autoindexing on the error register, the error would get overwritten on each loop. With a shift register, the error would get carried back to the beginning of the next loop iteration.
07-26-2007 12:11 PM