11-04-2009 12:44 PM
Hi folks!
I am trying to use a very simple "For Loop" with "16" iterations, and Shift Registers beggining in "0" and adding "4" each iteration.
But I am not successfull in outputing each iteration value! Only the final value of "64"!!
Is it possible to output each iteration value in every loop?
If it is, then could you provide an example?
Cheers!
Solved! Go to Solution.
11-04-2009 12:53 PM
Not sure exactly what you're trying to do here. You won't receive an output from the FOR loop until it's finished executing...after iteration #16. The output of your shift register will, of course, be your final value, as you are seeing.
If you want all of the values, you are going to have to use the FOR loop to create an array as your output. Your first iteration will be contained in element 0, the next one in element 1, etc.
See attached picture.
d
11-04-2009 12:56 PM
I wanted to output the individual value of each iteration, if possible.
If not, then i guess I could use an array.
However, can use "reshape array" to send each array element at a time.
For instance, send "0" first, then "4", then "8," etc...?
Cheers.
11-04-2009 12:59 PM
11-04-2009 01:02 PM
Well, as I said, you're not going to get anything out of the FOR loop until it's finished executing. So no, you can't output a value of 0 on your first iteration, do something with it, output a value of 4 on your second iteration, do something with it, etc...unless you put your processing code inside the loop. Does that make sense?
And what do you mean by "send"?
If you could post your code or be clearer about exactly what it is you want to do (the whole picture, not just the loop), we could be more helpful.
d
11-04-2009 01:03 PM - edited 11-04-2009 01:08 PM
11-04-2009 01:04 PM - edited 11-04-2009 01:08 PM
I am trying to create a For Loop that sends a value to a "Rotate Array".
But I need to rotate it more than once. The first value is zero, the second "4", the third is "8" and so on...
The array that I an trying to rotate is composed by the Address Bits of 16 multiplexers.
The final purpose is to change dynamically the Address Bits of 16 multiplexers.
I have tried to place my code inside the loop (a logical assumption) but I get an error 200010...
I have attached the vi.
Hope it helps.
Cheers.
11-04-2009 01:15 PM
I'm sorry...I'm still not clear on exactly what you're trying to do. You want to use a FOR loop to create an array containing the values 0,4,8...etc. You want to take that array and do something with it (rotate it). You want to rotate the array as you are creating it, and "send" it somewhere. Are you "sending" the entire 16-element array at the same time, or are you "sending" a single element at a time?
If you want to rotate the array as you are creating it, and then "send" it when you're done, put your "rotate array" function inside your FOR loop and perform your operation there. The output of your FOR loop will be your rotated array. Alternatively, as was suggested, you can use parallel loops and a queue or notifier to accomplish the same task.
If you want to "send" a single element at a time, then use parallel loops and a notifier. Your other loop will contain whatever code you're using to rotate the array and "send" your element.
Apologies if I have misunderstood what you are trying to do.
11-04-2009 01:22 PM
I have attached the vi.
Perhaps it's easier to understand.
Also , I am very new to LabVIEW and am not familiar with using "queues".
I apologyze for the confusion.
RSilva
Cheers.
11-04-2009 01:30 PM
Is it related to this thread of yours?
What are you trying to do now that is different then the message you marked as the solution in that thread?