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.

Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

DAQ program randomly hangs for 1-2 seconds

HI!

 

I have a problem with the data acquisition program I made. Here is the situation:

 

- We have an CompactDAQ data acquisition hardware.

- We use labview DAQmx

- The data are acquired with a rate of 1 Hz, during 24 h

- The data to acquire are: 

  • about 20 Analog signals
  • 1 digital signal
  • 2 Frequency signals

- two of the Analog signals are used to control a ventilator

- the rest of the signals have to be monitored, that is they have to be plotted on a graph.

 

My program works well for hours, but for a reason I don't understand, sometimes the program hangs for 1 to 2 seconds randomly. That means that the data buffer is filling. This situation can cause major problems, as I'm using the acquired data to control a ventilator. So my questions are:

 

-  has someone an idea why the program can hang for 1 or 2 seconds? It seems to be a Windows XP problem, as the loop I use for data acquisition in labview only needs 0,2 seconds to complete, so there is actually plenty of time left for other actions.

- Is there a possibility with DAQmx to clear the data buffer, or at least to read only the last values?

 

Thank you for you help!

 

Marc

0 Kudos
Message 1 of 4
(2,878 Views)

Hello Marc,

 

thank you for posting at the National Instruments Forum. I would like to help you, but I have a few questions to encircle the problem:

 

a) Is the CompactDAQ (cDAQ) Hardware connected to your computer directly or are you using some kind of USB-Hub? If so, please connect the cDAQ directly to the computer.

 

b) How did you configure the DAQmx Triggering/Sampling? Is it continuous, N-samples or 1-sample?

 

c) How do you find out, that the system is "hanging" for 1 to 2 seconds?

 

Best regards

 

MarianMO

Marian Vorderer
0 Kudos
Message 2 of 4
(2,863 Views)

Hello MarianMo,

 

Thank you for your help! Here is the reply to your questions:

 

a) Yes, the cDAQ is connected directly to the computer

 

b) I initialize a DAQmx continuous task outside of the loop, and in the loop I acquire the data, one sample at the time. The user can stop the program with a mouse click, and then the task is closed outside of the loop. I am using a timed loop right now, but I also tried with a standard loop.

 

c) I noticed that the system hangs first because the ventilator I control via my program started to swing. Then I used the feature of the timed loop to determine exactly when, and how long the loop hangs. I haven't found any clue yet, and it seems to happen randomly. I have programmed the timed loop to execute every second. When using the features of the timed loop, I see that the loop only takes 0.2 seconds to execute, apart from the time when it hangs...

 

So far, I have tried to restart the task when the timed loop detects a problem, in order to clear the buffer. But that takes quite a lot of time and didn't solve my problem.

 

I hop I answered your questions!

 

Best regards,

 

Marc

0 Kudos
Message 3 of 4
(2,861 Views)

Hi,

 

so are you stopping the timed loop, when it runs late? Is it possible, that you post your code here?

Marian Vorderer
0 Kudos
Message 4 of 4
(2,833 Views)