LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

DAQ assistant-need to update chart when collecting N samples

Solved!
Go to solution

Hi everyone, I have a question regarding DAQ Assistant. I need to acquire some data at low rates (ca 10 Hz). I want to acquire let's say 100 samples. I would also like my chart to update ten times per second. But when I choose collect N samples (100) at 10 Hz, the chart updates just once - after 10 seconds. Is there any other way to collect N samples and be able to watch chart updating 10 times per second than using continuous samples (10 Hz, 1 sample to read) with timer that ends the while loop after 10 seconds?

When I use the last mentioned way and write data to file, I always acquire 101 samples, not 100. And I think, that it is not an ellegant solution to write data to file ten times per second (at higher sampling rates, LabView does not manage to write all samples to .xlsx file, with TDM(s) files it is better). 

 

Maybe collecting 1 sample on demand would be ok, but so far I haven't had any experience with that. 

 

Thanks for your replies

Pinca

0 Kudos
Message 1 of 8
(3,195 Views)
Solution
Accepted by topic author Pinca

First, read this excellent White Paper about DAQ-mx and stop using the DAQ Assistant, which does not have the flexibility that you need to do what you are describing.

 

Do you see what you want to do?  You are asking to sample at 10 Hz, and want the Chart to update for every sample.  So how many samples do you want to take before adding the sampled data to the chart?

 

Now using the knowledge of what you learned in the White Paper, put down a few (you can do it in one) DAQmx functions to start the Acquisition, in a For Loop (with what wired to N?) take the appropriate number of samples and send that to the Chart, then at the exit of the loop, stop the Acquisition.  If you use Tasks (either created by MAX or by using the "New Task" command of LabVIEW Project), you should be able to accomplish this with as few as 3 DAQmx functions (I'd probably use 4) and a single For loop.

 

Bob Schor

0 Kudos
Message 2 of 8
(3,180 Views)

Hi Bob, thanks for your reply. I use DAQ Assistant for dynamic data type, which is data type I use for various purposes. 

So I tried to do it with DAQmx create channel, then I used a sample clock for specifying a rate (10 Hz)  and I connected it to a for loop, where DAQmx Read (read 1 sample per channel) was wired to a chart. This loop was executed 100 times and then everything worked. 

Thanks for help and have a nice day.

Pinca

0 Kudos
Message 3 of 8
(3,160 Views)

Good for you! I did drop a few hints, but was hoping you'd figure it out once I pointed you in the right direction.

 

Your mention of Dynamic Data is another excellent reason to not use the DAQ Assistant -- I've never really understood the purpose of this Data Format, and always found its functions so complicated and non-intuitive ...

 

Bob Schor

 

 

0 Kudos
Message 4 of 8
(3,155 Views)
Doing a single point acquisition means you are using software timing and the rate is actually widely variable unless your hardware supports hardware timed single point and unless you specifically program for it. Your requirement for an update of every millisecond seems quite arbitrary. If you stuck with using n samples and a reasonable number of samples (2 or more), the chart will update at a rate that is visually acceptable. As long as you use continuous sampling, the chart will display all data.

Never use the evil dynamic data. It can only cause problems and in any case, the underlying dt is invalid if you use 1 sample mode.
0 Kudos
Message 5 of 8
(3,139 Views)

Thanks for reply Dennis.

I do not need to do a single point acquisition, but when we are talking about the rates of 8-10 Hz, there is a difference in fluency of a chart if I choose to display every one sample or every 4 samples. 

Have a nice day

Pinca

0 Kudos
Message 6 of 8
(3,115 Views)

Your opinion about dynamic data type surprised me - I thought that this data type was built to simplify the whole data flow. Maybe it is the reason I use it - because I simply cannot imagine how to substitute Select Signals, Set Dynamic Data Atributes, Write to measurement file (maybe this one yes) or Merge or Split Signals Express VI. Thanks for your thoughts 🙂 

0 Kudos
Message 7 of 8
(3,109 Views)
The dynamic data type hides the underlying data since it can represent arrays, scalars, Booleans, etc. Much more understandable if you use the specific data types and use the lower level functions such as Index Array, Build Array, etc.
0 Kudos
Message 8 of 8
(3,097 Views)