Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

Access analog output buffer on fly

Solved!
Go to solution

Hi all,

 

I have a X-series DAQ and have done many analog input and output tasks. My question is that can an analog output buffer be accessed or changed while the task is running? I have a retriggerable analog output task and I want to replace the buffer after one trigger is done before next trigger coming in. Is it possible? Or put it in general, how can we access the buffer without re-creating the task?

 

Any feedback is welcomed. Thank you.

0 Kudos
Message 1 of 10
(5,207 Views)

Hi skuo1008, just a few questions:

 

  1. Are you referring to the PC buffer or the on-board buffer of your X-series DAQ? It would also be helpful to know which model/modules you are using to give some more context on what you're trying to do.
  2. When you say "replace the buffer" what do you mean? Are you trying to flush the buffer? If so, there is a VISA function that you should be able to use in your LabVIEW code to dynamically flush the buffer (VISA Flush I/O Buffer).

 

Documentation on VISA Flush I/O Buffer function:

https://www.ni.com/docs/en-US/bundle/labview-api-ref/page/functions/visa-flush-i-o-buffer.html

Jorr-El
Systems Engineer
Testeract: Automated Test Specialists
0 Kudos
Message 2 of 10
(5,188 Views)

Hi,

 

Thanks for reply. I am using PCIe-6363 X-series DAQ, and I am plaining to access the on-board buffer. When we create a finite analog output task and pass PC buffer to board by "DAQmxWriteAnalogF64" function call. I would like to change or replace the on-board buffer with a different PC buffer after the on-board buffer has been outputted. I was wondering if there is a way in DAQmx to do this dynamic on-board buffer I/O without using LabView functions.

0 Kudos
Message 3 of 10
(5,180 Views)


I would like to change or replace the on-board buffer with a different PC buffer after the on-board buffer has been outputted.

Could you explain this a little more? As far as I know, you cannot replace the on-board buffer with a PC buffer as they necessarily feed into each other and are completely separate hardware-wise.

 

Unless you're talking about changing which PC buffer the on-board buffer interacts with, which is generally handled by your OS. DAQmx has property nodes which you can use to set the size of the PC and onboard buffers, but there doesn't seem to be a way to change/replace/select different PC buffers. 

 

The PC buffer allocation is something that your OS generally takes care of, and isn't something that DAQmx doesn't seem to have control over.

Jorr-El
Systems Engineer
Testeract: Automated Test Specialists
0 Kudos
Message 4 of 10
(5,160 Views)

What I am trying to do is to prepare a circular PC buffer and set a finite analog output task with retriggerable on a PFI line. When the task is triggered, it will write the first part of circular buffer. Once it's done, it will take the second part of circular buffer and be waiting for the next trigger. When it reach the last part of circular buffer, it will go back to the first part of circular buffer. The task will be running contineously until user terminates that. I know it can be done by re-creating the analog output task at cycle done event, but I was hoping there is a better way of doing that. From the datasheet, it states "periodic waveform regeneration from host buffer including dynamic update" on AO waveform modes. I just don't understand how to do "dynamic update" part.

0 Kudos
Message 5 of 10
(5,119 Views)

Try looking at this example VI:

 

In LabVIEW, go to Help > Find Examples... > Hardware Input and Output > DAQmx > Analog Output > Voltage - Finite Output.vi

 

I know this is LabVIEW code, but all of the DAQmx functions in LabVIEW have analogs in text-based DAQmx that you can use to get the same behavior. I'm trying to work on this VI to see if there's a way to cause the program to wait on the next trigger.

 

I'll get back to you as soon as I can come up with something, but it might be helpful if you could take a look at it too and see if we can't come up with something between the two of us. I think what you're suggesting should be possible, we just have to find a way how to do it.

Jorr-El
Systems Engineer
Testeract: Automated Test Specialists
0 Kudos
Message 6 of 10
(5,091 Views)

For your signal output, are you trying to output a finite signal or a continuous signal? You said that you are creating a finite analog output task, but you want the task to run continuously. So for the end behavior, do you want your device to output a finite or a continuous analog signal?

Jorr-El
Systems Engineer
Testeract: Automated Test Specialists
0 Kudos
Message 7 of 10
(5,079 Views)

I am creating a finite analog output task but I want it to be retriggerable by an external digital trigger. Based on what I learned from NI DAQ, the task will act like an open-ended behavior, whenever there is a new trigger coming in, it will output the finite length of analog signal. I am not sure if we can say it output a contineous analog signal for the end behavior.

As I described before, I want to make changes on the finite length of analog signal in between the two consecutive external triggers. A side question, can we set the number of times of the retriggerable task to be triggered? It would be nice to have it to be able to be self-terminated.

Thank you for your help.

0 Kudos
Message 8 of 10
(5,073 Views)
Solution
Accepted by skuo1008

Hi Skuo1008,

 

What development environment are you using to write this code? You mentioned a text-based DAQmx function earlier in this post. Are you using LabWindows/CVI or ANSI C?

 

Take a look at these examples:

 

Analog waveform generation with output buffer update with DAQmx
http://www.ni.com/example/25039/en/ 

 

I've also attached them to this reply

Jorr-El
Systems Engineer
Testeract: Automated Test Specialists
Download All
0 Kudos
Message 9 of 10
(5,053 Views)

Thank you Jorr-El, I will try your methods, and I have it marked as solution.

 

Do you have any idea on the other post (Terminal count is reached for counter Input task) that I put on about setting terminal count in counter input task? First of all, I don't know how to set terminal count value in CI task, and it doesn't behave as I expected when it overflows. Really appreciate your help.

0 Kudos
Message 10 of 10
(5,043 Views)