Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

Cannot read back the output from an analog output channel

Hi!

 

I'm controlling an analog output module on my National Instruments PXIe-4322 card using the NI-DAQmx C API.

 

I want to be able to read back the output from a previously set output channel. From what I was able to find in the forums, one can use internal channels like "_ao0_vs_aognd" and add these as an analog input channel. Unfortunately, the PXIe-4322 card does not support this. (i.e. the internal channels don't exist)

 

I am therefore looking for a way to access the last set value which should still be in the memory of the card. This should be approximate to the actual value being outputted but this is good enough for my application.

 

How can I read the last-set value of an Analog Output channel using the NI-DAQmx C API?

 

Thanks and best regards

Laurens

0 Kudos
Message 1 of 4
(2,745 Views)

Hi Laurens,

 

Have you tried calling a DAQmx Read on the channel just after your DAQmx Write?  Some of things you mentioned above are here in the article, but there is also an example in LabVIEW that would apply to the DAQmx in C found near the bottom:

 

http://digital.ni.com/public.nsf/allkb/CB86B3B174763C3E86256FFD007A2511

 

Will you let me know if this method would work for you?

Adam
0 Kudos
Message 2 of 4
(2,667 Views)

Hi Mada,

 

Thanks for your response!

 

I have tried calling a DAQmx Read on the channel, however an analog output channel (AO) can not be read out.

 

Unfortunately the article you linked only describes how to read out an analog output channel by configuring an internal channel as an input channel. Since the PXIe-4322 does not have internal channels, I cannot use that method.

 

I am therefore looking into a way to access the onboard memory of the card, since that should have stored the last-set value somewhere. Would have any idea on how to access that?

 

Cheers,

Laurens

0 Kudos
Message 3 of 4
(2,660 Views)

I've been in similar discussions in the past.  The short answer is that (unless things have changed pretty recently) there's no DAQmx call that will tell you the value sitting in the D/A register at any given moment.

 

What I've resorted to is to keep track with my own software buffer that matches the buffer being fed to the task via DAQmx Write.  When I want to know the value being output, I query a DAQmx Write property called "Total Samples Generated" and use the result as an index into my own personal buffer copy.

 

Note: if the task is actively generating at the time of query, the value may change in the brief moments between the query and your ability to react.  Sorry, but no getting around it.  A software query of a task under hardware control will always have this kind of uncertainty.

 

 

-Kevin P

CAUTION! New LabVIEW adopters -- it's too late for me, but you *can* save yourself. The new subscription policy for LabVIEW puts NI's hand in your wallet for the rest of your working life. Are you sure you're *that* dedicated to LabVIEW? (Summary of my reasons in this post, part of a voluminous thread of mostly complaints starting here).
0 Kudos
Message 4 of 4
(2,654 Views)