LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

timer loop runs too fast

I've created a simple VI with an event structure that contains two timed loops. The timed loops are in different event cases and are not linked in any way. Both loops use the 1KHz clock which resets at the structure start and a loop period of 25ms. The loops run for 5 seconds each before finishing which completes their respective event cases.
When I run the program, I notice that the timed loops execute almost twice as fast as I expected and for no apparent reason. If I probed the expected start time, this returns the correct value for each iteration, ie: 25ms, 50ms, 75ms....., but the actual start time seems to have a mind of its own. The only way I've found to make the timed loop run correctly is to delete an event case containing one of the loops.
Can anyone shed any light on this odd behaviour ?
 
Regards,
Andy.
0 Kudos
Message 1 of 8
(4,466 Views)
Andy,

can you please post your VI? Which version of LV are you using?

Norbert B.
Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
0 Kudos
Message 2 of 8
(4,459 Views)

Norbert,

 VI attached as you asked for. I've saved the program for Labview V8.0, although It was written in LV8.2.

Hope you can find something that's causing the problem with the program, it's got me stumped!

 

Regards,

Andy

 

0 Kudos
Message 3 of 8
(4,437 Views)
Do you have any errors being generated that are fed into the error input terminal of the loop?  Put an indicator on that wire to see.  I discovered that if an error is fed into the error input of a timed loop, the loop will not execute at all.  Thus, perhaps the outer loop is coming around again and entering the event structure and the inner loop and occurring fast than what a single iteration of the inner loop would occur at.
0 Kudos
Message 4 of 8
(4,431 Views)

No, there are no errors generated when the VI runs. I've fed the error signal into the timed loop intentionally to prevent it from running if an error did occur beforehand, but this is not the case here. After running, the timer values and output voltage levels are written to an array on the front panel. It is the timing values in this array which show there to be a problem with the timed loop structures. If an error did occur before the timing loop begins, this array would be empty,

Any other ideas ?

Regards,

Andy

0 Kudos
Message 5 of 8
(4,429 Views)
I ran this under LabVIEW 8.5 (after removing all the VISA calls to the power supply) and it seemed to run fine. Each loop runs for 5 seconds (timed against my watch and computer clock) and each of the 199 array elements shows 0.025 second increments.
0 Kudos
Message 6 of 8
(4,422 Views)

Thats interesting, and perhaps has solved the mystery.

The target PC I'm using has a dual core processor, which may be the cause of the timing problem. Is your PC a single core machine by any chance?

If this is the cause of the problem, then my next question is, what can I do about to resolve it?

 

Regards,

Andy

0 Kudos
Message 7 of 8
(4,420 Views)
Yes, I'm running on a single core processor, however, I fail to see how a dual core would make a timed loop run faster than normal. Even if each loop is on it's own core, the timing should still work as advertised. I run a dual core at work and use timed loops without a problem. Interesting issue.

You might try removing the manual setup of which core to use. My understanding is that only works on a RTOS anyway. Shot in the dark.

I'm running LabVIEW 8.5 by the way.
0 Kudos
Message 8 of 8
(4,416 Views)