LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

timed loop speed

I am running the DAQmx Cont Acq & Chart (hw timed).vi example on a Compaq nc8000 laptop with a DAQCard-6024E.  The example is exactly what I need and runs great.  My question is how fast can I expect the timed loop to execute?  Scan rates of 0 -> 200 work great.  Larger scan rates gives the ERROR:Program was unable to keep up with the sample clock.  This seems slow.  In need to be able to do accurate loop times in the order of 3000 times a second.  Any ideas would be appreciated.
0 Kudos
Message 1 of 6
(3,339 Views)

Hi Richard,

It looks like you are trying to perform a hardware timed acqisition using a timed loop. There is another hardware timed example in the LabVIEW example finder that I think would be better for your application. I recommend taking a look at the Continuous Acquire and Graph-Internal Clock Example.  It is located in Help >> Find Examples >> Hardware Input and Output >> DAQmx >> Analog Measurements >> Voltage.

I curious as to what is your reason for running the loop 3000 times a second. Are you trying to acquire 3000 samples/second?  If this is the case, then you can setup your acquisition to acquire those samples without having to execute the loop 3000 times. You can specify your sample rate and number of samples to read with this example. I hope this helps.

Regards,
Hal L.

0 Kudos
Message 2 of 6
(3,312 Views)

Thanks for the reply,

OK, the rest of the story.

I need to be able to capture and write to a file data (6 analog channels) in the order of 3000 times a second.  The first column in the data file needs to be a time stamp.  I have this all working great, BUT the internal system millisecond timer does not have the needed resolution.  Depending on the sample rate I get 10 to 30 data samples per clock tick.  My thoughts were to get a stable, fast external clock to do the time stamp for me.  My implementation of this was the timed loop, which turned out to have its own set of problems.  Any further thoughts you might have would be appreciated.
 
Thanks,
Richard
0 Kudos
Message 3 of 6
(3,299 Views)

Hi Richard,

I still think that you can use the Acquire and Graph Internal Clock.vi.  If you set the clock to acquire at 3000 Hz, acquire 3000 samples, and send your data to a "Write LabVIEW Measurement File" express vi, then the first column will automatically be the timestamps that you desire and you will acquire the correct number of samples. I am posting an example program for you that will help you with your application.

Regards,

Hal L.

0 Kudos
Message 4 of 6
(3,271 Views)
Thanks for the example.  I'm learning a lot, with your help.  Your example works great as is, however it only executes once since there is no while loop for multiple executions.  Thought it would be simple to add the loop but I get Error 200278 Read error.  "Attempted to read a sample beyound the final sample acquired.  The Acquisition has stopped, ......  Specify a position and offset which selects a sample up to, but not beyound the final sample acquired".  Again your thoughts would be appreciated.  I have attached your original example with my while loop added.
 
Thanks,
Richard
0 Kudos
Message 5 of 6
(3,249 Views)
Hi Richard,
 
The reason that you are receiving this error is because your DAQmx timing vi is configured to acquire finite samples but you are trying to perform a continuous acquisition with the while loop in your program. You can correct this by changing the "finite samples" input to "continuous samples." Another great example to look at for a continuous acquisition is Cont Acq&Graph Voltage-Int Clk.vi.  This example is located in Help >> Find Examples >> Hardware Input and Output >> DAQmx >> Analog Measurements >> Voltage.
 
Regards,
Hal L.
0 Kudos
Message 6 of 6
(3,238 Views)