04-05-2012 11:11 AM
I am trying to do some continuous data streaming with a Labview FPGA and periodically generate a trigger signal
to the timestamp after a fixed number of iterations.
The strategy I was going to try was to look at the iteration index in the timed loop and every time it rolled over to a fixed number I would generate a trigger from the FPGA.
I looked to see what happens when you get to 0x7FFFFFFF samples on the I32 register and apparently
the index does not roll over..it simply stays at the max count after it reaches it.
Is there any way to make the index on a timed loop roll over? Otherwise i wil just add another
U32 variable and increment it each cycle and let it roll over.
Solved! Go to Solution.
04-05-2012 12:00 PM
If you're performing an action after n iterations, couldn't you reset a shift register counter at the same time? Start at 0, increment each time, reset to 0 when you hit your number.
04-05-2012 12:14 PM
I would use the modulus function. This is basically the remainder portion of the division operations.
For example, if you wanted every 3rd number:
1 % 3 = 1 --> False
2 % 3 = 2 --> False
3 % 3 = 0 --> True
4 % 3 = 1 --> False
5 % 3 = 2 --> False
6 % 3 = 0 --> True
etc
04-05-2012 12:29 PM
You cant do the modulus in a single cyle timed loop. It takes too many iterations.
I can patch around by settign up my own variable and indeed it rolls over. I was just suprised to find the iteration counter
will saturate an not roll over when it gets beyond 0x7FFFFFFF. At least it does this in a generic while loop.
I am settign up a single cyle timed loop to test whether it does the same.
04-05-2012 01:08 PM
A SCTL won't increment the index, it runs once then exits. If modulus doesn't meet your needs then an incremented shift register is probably the simpliest way to go. Pretty small FPGA footprint, will do everything you're asking for here.
04-05-2012 08:59 PM
the iteration counter will not roll over. it is historical at this point why but just use a shift register, local or feedback node instead.