From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Incorrect Timing with Timed Loop

I am working on a VI where I am currently using a timed loop to acquire voltage and thermocouple data with NI 9219 and NI 9211 modules.  I have 1 task set up and am writing all of the data to a file.  When I set the timing loop to acquire data at intervals greater than 1 second (ie period = 1000 w/ a 1 kHz timing source) everything seems to work fine.  However, if I decrease the period to say 500 ms, it doesn't work properly.  I am not getting 2 samples per second of data.  I have attached a screenshot of my vi for reference.

 

Has anyone else seen any problems like this?  It seems fairly straightforward, but I can't figure out what I am missing.


Thanks in advance,

Taylor

 

ThermalVI.JPG

0 Kudos
Message 1 of 10
(3,303 Views)

The array building and graphing is taking too much time so...

 

Search this site for "Producer/Consumer" design pattern ( it seperates the DAQ from the acumulate and display work)  to run regularly.

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 2 of 10
(3,297 Views)

Okay, I just removed everything from the loop with the exception of the DAQmx read to get rid of all overhead.  When I stop the loop, I write out the last data point and the increment number.  It is still not timing correctly (ie if I let it run for 10 seconds at a sampling rate of 5 S/s, it should have incremented 50 times but instead it only incremented 8 times).

 

-Taylor

0 Kudos
Message 3 of 10
(3,286 Views)

Please post a new image.

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 4 of 10
(3,282 Views)
ThermalVI2.JPG
0 Kudos
Message 5 of 10
(3,278 Views)

It is unusual that DAQ can't keep up with a twice a second single point read, so I thought you would get away with it. Apparently "not on your machine". So switch over to hardware timed acquistion and let the clock on the board do the measurements instead of relying on software timing.

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 6 of 10
(3,269 Views)

That is working properly now.  Thanks for the advice. 

 


One more question, is there any way to control the acquisition rate from the VI or only in the Measurements and Instrumentation Explorer?

0 Kudos
Message 7 of 10
(3,257 Views)

I THINK you can right-click on your task control and choose "generate code...". The resulting sub-VIs (the one for configuration) should be setting the sample rate. make it a control, put it on the icon connector and then you will be able to specify the sample rate via your code when it starts.

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 8 of 10
(3,253 Views)
After doing some experiments with my hardware, I feel like it should be able to run faster than 1 S/s.  Is there any settings that I need to be aware of or drivers that could potentially need updating?
0 Kudos
Message 9 of 10
(3,231 Views)

Hello Taylor,

 

After looking over your code and looking into you hardware, the max sampling speed of the 9211 is 14 S/s and the 9219 max sampling speed is 100 S/s. In order to get a better idea of your system, are you running in real time system or a windows environment? If you are running in a realtime environment, you would need to change your timing source to the 1 MHz clock in order to sample at a higher speed. If you are in a windows enviroment, I would suggest to change your sampling to continuous with a desired sampling rate. It looks like you have created the task in MAX so you can change the sampling rate under Time Settings section.

 

JimS.


Jim St
National Instruments
RF Product Support Engineer
0 Kudos
Message 10 of 10
(3,194 Views)