LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Change data of Analog Output task without stoppig it

hello,

 

I am using NI Hardware consisting of Analog Output Voltage channel. I have configured voltage output channel to run in continuous sampling mode. The data being generated by the voltage output task has to be changed after some time. Can i write new data to my analog voltage output task without stopping the task ?. 

0 Kudos
Message 1 of 9
(4,630 Views)

Sure, I don't see a problem with it.

Capture.PNG

0 Kudos
Message 2 of 9
(4,605 Views)

I might be wrong but I think your example shows software timed generation whereas I'm doing a hardware timed continuous sampling mode data generation. My data consists of fixed number of samples repeated continuously. I need to change this data after sometime. But the number of samples in each of my data set is same.

I hope I'm able to put my thoughts in words properly.. 🙂🙂

0 Kudos
Message 3 of 9
(4,593 Views)

Attach your VI then we can see what you are doing now and suggest and suggest a more appropriate change.

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

gargrahul_0-1614280932123.png

 

 

Please find the vi in the attachment as well.

 

The Analog Output channel is configured for continuous sampling mode. Voltage Generation will start when user clicks on Set Data. data will be generated continuosly. User can enter new frequency or amplitude value and click on Set data to change the Data being generated. Once the user clicks on Set data new data value will be generated continuously.

 

I hope i have made my case clear. Please let me know if you require further input.

 

Thanks.

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

Please note that i have the set value of 'Auto Start' input for DAQmx Write.vi as 'True'.

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

As I look that code over I'd quibble about several little style things, but functionally it looked to me like it ought to work.

 

So what actually happens instead?  Do you get a task error and if so, what is it?

 

The first thing I'd try to change would be to call DAQmx Start explicitly before the loop instead of using auto-start.  I prefer to know exactly when I'm starting and stopping my tasks.  Auto-start makes things less clear.

 

 

-Kevin P

ALERT! LabVIEW's subscription-only policy came to an end (finally!). Unfortunately, pricing favors the captured and committed over new adopters -- so tread carefully.
0 Kudos
Message 7 of 9
(4,527 Views)

i took trial with the code.

 

Voltage starts generating on the output channel when i click on set data and data is generated continuously. When i change the Frequency or Amplitude value and click on set data again. The data change doesn't happen instantly on the output channel. Data change is observed after a very long wait maybe somewhere around 20 secounds or more.. 😅😅

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

First, friendly advice to help you help yourself.  The info you just now provided is the crucial detail, but there was no hint of it in your earlier descriptions.

   Speaking for myself (but expecting several others will at least nod along), I'm much more inclined to offer my time and help to someone who has obviously spent their own time being careful to describe their issue clearly and thoroughly right from the start.  Some time to describe what you *want*.   Some time to describe what you did, i.e., the things you tried and how you did them, including attachments of code when possible and sometimes data too.  And then some time to clearly describe your observations of what you *got*.

 

Ok, back to your issue.

 

That long delay you see is a side-effect of buffering.  There are at least 2 buffers to consider, and the general rule is that bigger buffers lead to longer delays.  Here's a really good overview about output buffers (with emphasis on USB devices that need to involve a 3rd buffer).

 

First there's the task buffer that your calls to DAQmx Write interact with directly.  For Continuous Sampling tasks, the buffer size is set by the # samples you write to the task prior to starting it.  (There are also ways to size it explicitly if you choose.)   The size of the task buffer affects how long it can take from the time you write until the data is delivered to the board.  It's pretty much a high limit on the time.  Depending on exactly when you write relative to what the driver is doing independently to deliver data to the board, the delay (also called "latency") may be shorter.   When you want shorter delays, you make this buffer smaller.  (When not using the default "regeneration" feature, this also means you must write more often.)

 

Second, your DAQ device has an onboard hardware FIFO buffer.  The size available for this buffer varies greatly by specific device model.  All data delivered by DAQmx to the board must travel through this FIFO before being generated as a real world signal.  However, there are some advanced DAQmx properties available that can help limit how *much* of the available FIFO buffer gets used.  It seems that some properties are only relevant & useful for a particular subset of devices -- you'll need to do some experimenting to discover what to use for your as-yet-unidentified device.

 

 

-Kevin P

ALERT! LabVIEW's subscription-only policy came to an end (finally!). Unfortunately, pricing favors the captured and committed over new adopters -- so tread carefully.
Message 9 of 9
(4,475 Views)