LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Continuously Looped counting within a while loop

Hi Everybody, I have the following probelm which I hope I can get some suggestions on:-

I need to be able to send 0 -> 15 in binary format to a digital port, in a continuous loop. That is 0 -> 15 -> 0 -> 15 etc...

Now this loop of 0 -> 15 must be <> with the while loop that it is inside of. The while loop will be continuously looping, wheras if a for loop was used for the (0 -> 15 -> 0 -> etc) count it would need to restart every 16 iterations in step with the while loop). Please refer to the attatchment to see the while loop structure.

The while loop starts, then I will need the digital data (say 0) to be sent to the digi port, this will then lead to me acquiring data. The while loop sta
rts again and now 1 will be sent to the digital port etc...
When it gets to 15, I want it to start again at 0...

I am not sure if a for loop can be used as the info is kept 'at the edge' until the iterations are done. This would be utterly useless.

I have hit a wall on this...
Any suggestions would be very helpful.

Thanks.

System info:-
I have labview 7 express on a 2000 machine.
0 Kudos
Message 1 of 4
(2,906 Views)
I can't open your example because I don't have LV 7 yet but you don't need to nest any kind of loop inside your main while loop. Wire the iteration terminal of the while loop to the x input of the Quotient & Remainder function and wire a constant value of 16 to the y input. The x-y*floor(x/y) output will cycle continuously from 0 to 15. This is how you implement the modulo function in LabVIEW.
0 Kudos
Message 2 of 4
(2,906 Views)
Let me break your wall for you.

The remainder resulting from dividing the loop index by 16 will always be in the range 0 to 15. Simply insert the good 'ole Quotient & Remainder function. I did it for you in the attached VI.

Don't be afraid to get an Alliance Member like us involved. We do this stuff every day.

Daniel L. Press
PrimeTest Corp.
www.primetest.com
Message 3 of 4
(2,906 Views)
I would just like to say thank you to both you guys for your answers! The wall has indeed been demolished!

Have a nice day!
0 Kudos
Message 4 of 4
(2,906 Views)