LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Why use FPGA Loop Timer instead of FPGA Wait to time loops?

Since I learned that the Loop Timer will overflow once the loop has been running for long enough, I'm hesitatant to use it to time my FPGA while loops.  Would just placing a Wait VI in parallel with the code in the loop do the trick?

 

-Dan

0 Kudos
Message 1 of 5
(7,214 Views)

A loop timer will ensure that the loop executes in the specified time (Count input).  It will execute the code within that loop and then wait the required amount of time so that the "Count" input is reached.

 

A Wait function will always wait the specified input time regardless of how long the code inside the loop takes to execute.  

 

Either is fine to use but be aware of the differences.

 

Also, I am not aware of any overflow using the Loop Timer.  Where did you learn this?

 

Dan

0 Kudos
Message 2 of 5
(7,184 Views)

Hi Dan(s),

 

This would be news to me. The finite space used on the loop timer refers to the space allocated to store the number of seconds/ticks between iterations, not the number of iterations. Thus, there is a limit on the time between executions for a given timing resolution, but not the number of iterations. If you've encountered a situation that indicates otherwise, please post some code and we can look more into it. This is definitely something we would want to know about. Thanks!

Verne D. // Software R&D // National Instruments
0 Kudos
Message 3 of 5
(7,178 Views)

Verne,

 

Yes, that would be my understanding as well.  Let's see what the other Dan has to say.

 

Dan B.

0 Kudos
Message 4 of 5
(7,175 Views)

Okay. Maybe I misunderstood something I saw.

 

On one of the FPGA training slides, it stated that :

  • Subsequent iterations of the Loop Timer Express VI adds count to the initial time and waits until Count has elapsed from the initial recorded time.
  • The Loop Timer only reestablishes a new reference time stamp when a loop iteration takes longer than the specified Count.

 

So I figured (perhaps naively) that if you are always comparing the current timestamp to the initial time then you would eventually have an overrun problem?  And this was the problem with the "maximum tie the timer can track".

 

From your comments, though, it sounds like this isn't a problem.  Let me guess that what is really happenning is that Count is added to the previous loop's count (and rolls over if necessary) and the timer simply waits for this new timestamp.  The first iteration timestamp is in fact not retained.

 

-Dan

0 Kudos
Message 5 of 5
(7,164 Views)