LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

I32 iteration index rollover in continuous data acquisition

Solved!
Go to solution

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. 

0 Kudos
Message 1 of 6
(2,889 Views)

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.


--Using LV8.2, 8.6, 2009, 2012--
0 Kudos
Message 2 of 6
(2,882 Views)

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

Cory K
0 Kudos
Message 3 of 6
(2,877 Views)

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.

 

 

 

0 Kudos
Message 4 of 6
(2,870 Views)

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.


--Using LV8.2, 8.6, 2009, 2012--
0 Kudos
Message 5 of 6
(2,860 Views)
Solution
Accepted by topic author Snowpac

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.

Stu
0 Kudos
Message 6 of 6
(2,841 Views)