LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Lag In Displayed Data

Hi, Could someone please tell me where Im going wrong here.

 

Im just trying to read some data from strain gauges using DAQmx and display the data in the graph.

 

But the problem I have comes when I apply a force onto the product where the strain gauges are mounted, the change in data on the graph doesnt appear until about 5 seconds after.

 

I think this is something to do with my sample rate set up and the loop timming, but i cant figure out what it is.

 

I have attached the VI and a few screenshots.

 

Many Thanks

Rhys.

0 Kudos
Message 1 of 6
(2,515 Views)

Need to see your code for dequeueing into the graph.

You're pushing data into the queue faster than it can be processed.

 

How often are you needing to update the graph?

Try passing more data into each queue element instead of running point by point.

Your acquisition loop wouldn't need to spin as fast if you were sampling 100 points at a time or so.

0 Kudos
Message 2 of 6
(2,503 Views)

See the vi attached for the code (Test Page.vi).

 

I think its something to do with the reading of the data though. I have removed the queue and placed the graph directly onto the DAQmx Read and I still get the same problem.

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

How have you configured your task?

As it stands, you are reading one point from the buffer on each loop iteration.

Your loop is spinning as fast as the processor will alllow.

 

Updating the graph that quickly is probably not helpful.

Pull more samples from the buffer or configure your task to pull a measurement on demand.

0 Kudos
Message 4 of 6
(2,466 Views)

I have configure the task to sample at 1kHz continuous samples.

 

Could you show me in a vi how you would do this?

0 Kudos
Message 5 of 6
(2,458 Views)

There is a couple more questions.

 

You have 3 tasks, how many channels do they have?

How are the channels linked to hardware ?

What hardware are you using?

 

I doubt that you are able to read 1 sample every ms in your while-loop. My gues is that you are filling the DAQ buffer and getting a warning there. Try to read more sample at a time. Do that by selecting a different read method.

 

From the picture I can also se that the tasks and error tunnels out of your case structure is set to "Use default if unwired". That is not a good option for DAQmx tasks and errors, as you will loose the task and errors.

 

From your VI there is a coulpe more problems.

You are missing a stop and clear Task. When you are working with DAQmx tasks, you need to stop and clear the task after you are finished with it.


You are starting your DAQmx task outside the while loop, but inside the while loop you have and idle state that is pulling a button. This means that as long as you are in the idle state, the DAQ is buffering data in its internal buffer. When you are starting to read you will get the oldest data first, one sample at a time. So you will be reading sample from a time long before you hit the start button.

 

Your have some changes to make now. Change your code, try it and post back what you have changed and if it works or not.

0 Kudos
Message 6 of 6
(2,448 Views)