LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Real time plot using DAQmx

Hello everyone, I'm a graduate student and I'm new to LabView.

 

I'm making an app that is ploting a rectified sin with the plato using a signal simulate and also acquires the data and plots it at the same time on the same plot area.

My plot has to start from 0 time so that's why I don't use DAQ assistant.

 

If I use a sample rate of 100 and 8000 the plot is continious and for any other it's discrit. It looks like it collects the data and only then plots it.

 

My question is if it's possible to use any other sample rate for the plot that it will be a real time.

 

 

Thanks for any help!

0 Kudos
Message 1 of 9
(4,565 Views)
I don't know what your definition of real time is. How fast you write to a graph/chart has nothing to do with sample rate. Its not a LabVIEW issue either. It is a data acquisition basic and is just simple arithmetic. Divide the number of requested samples by the sample rate and you get the time it will take for the acquisition. That is as real as the time gets. You can't plot until the time you specified is up. If you want faster updates, request fewer samples. If you are in continuous acquisition mode, you won't lose any samples. A sample count 1//10 the rate is a good place to start.
0 Kudos
Message 2 of 9
(4,555 Views)

Thanks for reply Dennis,

 

I'm sorry for my not clear desription, maybe I can explain it differently:

 

Sample rate gives a number of measurments per second (as I understand). In my app I'm ussing a continious sampling with the sample rate of 100 measurments per second. With this sample rate each point of the graph is plotted as soon as its data was acquired. The same for the sample rate of 8000 measurments per sec. But when I'm trying to change sample rate to 200 or anything else the data is plotted with the delay. What sample rates I can use in order to plot the data as soon as it was acquired?

 

0 Kudos
Message 3 of 9
(4,551 Views)
Again, your understanding is completely wrong. To talk just about sample rate is nonsense. You must also talk about number of samples that you request. These are the two parameters with either the DAQ Assistant or the DAQmx Timing function. If you do not understand that acquiring 1000 samples at a 1000 Sample/sec rate and acquiring 1000000 samples at a 1000000 Samples/sec rate will both take exactly the same amount of time (1 sec) then I don't how anyone can help. Set the sample rate to about 10 times the Nyquist criteria and set the number of samples to a value that will give you an update rate you want. You simply cannot set one value without consideration of the other.
0 Kudos
Message 4 of 9
(4,542 Views)

Thanks Dennis.

 

I specified the number of samples (20) in a DAQmx read and a sample rate (200) in DAQmx timing. But the problem remains. My graph chart starts from 0 relative time but the acquired data plot doesn't start from 0 it starts from 3 seconds instead.While the rectifed sine graph starts from 0.

0 Kudos
Message 5 of 9
(4,513 Views)

Attach your VI. I don't understand what you mean.

0 Kudos
Message 6 of 9
(4,505 Views)

Thanks for your help Dennis, I've attached the vi

0 Kudos
Message 7 of 9
(4,470 Views)

I think I misunderstood what you meant by real time. You want the chart to show actual elapsed time in seconds? When I run your VI, that is what I see. There is a single chart that starts at 00:00 and seems to be keeping correct time.

0 Kudos
Message 8 of 9
(4,451 Views)

Yes, I want the chart to show actual time. It's works fine with sample rate of 100 and 10 samples but if I change rate to 200 and 20 samples for example the plot is delayed (blue line coming from daq). It plots the graph by part not point by point. When I go with 10000 sample rate and 1000 sample it's fine again as with 100 and 10.

0 Kudos
Message 9 of 9
(4,443 Views)