01-30-2013 04:43 PM
I was trying to count time using a VI like the one attached.
My trouble is that this is not couting correctly. There is a possible reason I observed.
Maybe the computer is not able to process the VI as fast as necessary.
I thought about this because, when in edition mode the time counting was very wrong, and, when I created an aplication and installed it, it was running ok, as it got "light". But today, when I tryed to use this aplication with an old computer it didn't work. The clock is delaying.
Is it possible to count the time correctly?
I'm using a DAQ6009 to do my works, my VI is pretty big, and I need an iteration at each 1 ms (milisecond) as I'm using digital inputs to count 5 encoders events (I know that this is not the correct way to count encoders, but this is the only way I can do that, and it's working).
Thank you all in advace! hope you can help me!
hugs!
Solved! Go to Solution.
01-30-2013 06:15 PM
1. What makes you think it is not counting correctly?
2. What makes you think that any desktop operating system can update its screen 1000 times per second?
3. The USB-6009 has software timed digital I/O. It is likely that the fastest it can read digital inputs is a few hundred times per second and occasionally the interval between reads could be several 10s of milliseconds or longer.
By the way it is not considered polite to post VIs which do not have a stop button or which do not terminate themselves after a relatively short time. The use of the Abort button to stop a VI is a last resort for code which does not perform as expected during development.
Lynn
01-31-2013 07:08 AM
I know it's not counting correctly because I compared with a standard stopwatch.
This VI is just an example, to make look clearly what I want to show you guys.
All I want is to learn, I have nobody close to me to ask about, english is not my native language and all I learned about labview I owe to the good guys that helped me at this forum. Sorry if someone feels bad about something I did wrong here, I just didn't want to do that.
01-31-2013 07:48 AM
Hello,
Refer attached vi.
There is difference between Wait(ms) VI and Wait until next ms Multiple VI.
Regards,
Bijay
01-31-2013 10:17 AM
OK. Let me try to help you understand a few things.
The Tick Count and Wait (and Wait Until Next ms Multiple) functions all use a 1 kHz clock that is derived from the processor clock. The accuracy of these clocks is not great, although probably comparable to your stopwatch accuracy. Any timing generated by these functions will show some differences from the time of day clock as it is derived from a different oscillator.
The front panel updates are timed both by LabVIEW and the OS. Most screens are updated 60-80 times per second, maximum. Depending on what else the OS is doing, a screen update could be delayed 10s of milliseconds or longer. It is certain that not every value at the output of the Add function will be displayed.
The Wait Until Next ms Multiple will wait more than 1 ms if the other code in the loop takes longer than 1 ms. I am not sure, but I think the indicator is buffered so that any delays by the OS in updating the display should not slow the loop. I tried removing the indicator and it did not seem to make much difference.
I modified your VI to provide several indications of performance. First, I added the three-frame sequence structure to allow timing of the loop. Second, I changed to a for loop which will run a preset number of iterations. Third, I connected the output of the Wait Until Next ms Multiple timer to an autoindexing tunnel so that a record of the time of each iteration appears in the Ticks array. I calculated the differences between successive times and displayed that on a graph so that you can see the performance.
I did not mean to sound critical of your use of English. You write in English much better than I could in your language! The point I was trying to make is that general descriptions such as "is not counting correctly" without quantitative results or evidence to support the claim do not have enough information to help us help you.
Lynn