Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

Where are DAQmxSetReadAttribute and DAQmxGetReadAttribute?

Hi,
 
These two functions are used in one sample code provided online, but I can't find them in the DAQmx C ref. Are they introduced somewhere?
 
Thanks!
David
0 Kudos
Message 1 of 6
(4,363 Views)

Hi David-

Those functions are provided by the LabWindows/CVI API and are not documented in the standard DAQmx C Reference Help.  They only provide wrappers for CVI function panels around the various DAQmx Read Properties and do not add any additional functionality beyond what is available in the standard C API.  Which example are you referring to?  I may be able to suggest an equivalent standard C example.

Thanks-

Tom W
National Instruments
0 Kudos
Message 2 of 6
(4,357 Views)
 

Hi, Tom,

I am referring to the sample code 200308 at https://forums.ni.com/t5/Example-Code/Archived-NI-DAQmx-Continuous-Analog-Input-with-Both-Start-and/... I also checked the 200307 in that page and it is a Labwindow/CVI project. It seems none of those codes are in standard C API. Would you please check it and provide the alternative standard C API for 200308?

Thank you very much!

David

0 Kudos
Message 3 of 6
(4,347 Views)

Good afternoon David_Lin, 

Thanks for contacting National Instruments with your issue, we'll try our best to resolve it for you as quickly and efficiently as possible. 

If you've installed the NI-DAQ driver software onto your computer, and included the ANSI C support, you should have a folder similiar to this on your hard drive:

C:\Program Files\National Instruments\NI-DAQ\Examples\DAQmx ANSI C\Analog In\Measure Voltage\Cont Acq-Int Clk-Anlg Start

This ANSI C shipping example will be a great starting point for making an example equivalent to the ones found at https://forums.ni.com/t5/Example-Code/Archived-NI-DAQmx-Continuous-Analog-Input-with-Both-Start-and/....
 
All we have to do is modify the code to have a Digital Edge Start Trigger instead of the Analog Edge Start Trigger and then add a Digital Edge reference Trigger.
 
To do this, delete the following two lines of code in the shipping example:

DAQmxErrChk (DAQmxCfgAnlgEdgeStartTrig(taskHandle,"APFI0",DAQmx_Val_Rising,0.0));

DAQmxErrChk (DAQmxSetAnlgEdgeStartTrigHyst(taskHandle, 1.0));

And replace them with:

DAQmxErrChk (DAQmxCfgDigEdgeStartTrig (taskHandle, const char triggerSource[], DAQmx_Val_Rising ));

DAQmxErrChk (DAQmxCfgDigEdgeRefTrig (taskHandle, const char triggerSource[], DAQmx_Val_Rising , uInt32 pretriggerSamples));

Of course you'll want to replace the input parameters with valid ones that meet your requirements for the triggerSource, rising/falling edge and how many pre-trigger samples you wish.  To get an explanation for these functions, in Windows go to Start > Programs > National Instruments > NI-DAQ > NI-DAQmx C Reference Help.

Once the help file is open, in the Contents tab, navigate to NI-DAQmx C Functions > Triggering > Start Trigger  and Reference Trigger, to view the various triggering functions available to you in the ANSI C DAQmx API.

Best of luck with your project.

Regards,

Minh Tran
Applications Engineering
National Instruments

0 Kudos
Message 4 of 6
(4,331 Views)

Hi, Minh,

I am not quite clear which code you referred to. In the file ContAcq-IntClk-DigStart&Ref_Fn.c of the shipped code 200308, there are two functions

// Starts the task.
int32 Start_ContAcqIntClkDigStartRef(TaskHandle taskHandle)
{
 int32 error=0;
 DAQmxErrChk (DAQmxStartTask(taskHandle));
 DAQmxErrChk (DAQmxSetReadAttribute (taskHandle, DAQmx_Read_RelativeTo, DAQmx_Val_CurrReadPos));
Error:
 return error;
}

// Reads the samples left
int32 ReadSampLeft_ContAcqIntClkDigStartRef(TaskHandle taskHandle, float64 data[], uInt32 numChannels, int32 *read)
{
 int32 error=0;
 DAQmxErrChk (DAQmxGetReadAttribute (taskHandle, DAQmx_Read_AvailSampPerChan, read, 0));
 if (*read >0)
 {
  DAQmxErrChk (DAQmxReadAnalogF64(taskHandle,-1,10.0,0,data,(*read)*numChannels,read,NULL));
 }
Error:
 return error;
}

And I couldn't find the help of the two APIs DAQmxGetReadAttribute and DAQmxSetReadAttribute. Then Tom told me it is CVI, not standard C API. So are there counterparts of these two CVI functions in the standard C API?

Thank you.

David

0 Kudos
Message 5 of 6
(4,319 Views)

Good morning David,

The code I was referring to were examples that get installed with NI-DAQ driver when you install it.  As long as you selected C-support when installing NI-DAQ, you should have the examples I mentioned, in the locations I mentioned.  It will be a lot easier trying to modify those examples to get them to what you want them to do, then to modify the code on the web.  There are no direct counterparts of these two CVI functions in C.

Regards,

Minh Tran
Applications Engineering
National Instruments

 

0 Kudos
Message 6 of 6
(4,313 Views)