Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

DAQmx introspection in C

Solved!
Go to solution

I am trying to create program that dumps the setting/properties of a channel to disk. I am targeting using the C library, but I could do it with .NET. I would like to do it without coding each and every property of each channel and measurement type. Is there any way to programatically know the properties of a given channel type?

 

To be more concrete, given a channel name I will do the following steps:

1.- Use DAQmxGetChanType to get the channel type (lets say DAQmx_Val_AI)

2.- Then use DAQmxGetAIMeasType to get the measurement type (lets say DAQmx_Val_Voltage)

 

I would need a function that returns ('DAQmxGetAIVoltageUnits', 'DAQmxGetAIVoltagedBRef', 'DAQmxGetAIVoltageACRMSUnits') or something like this so I can iterate through all of them and obtain their values.


Then I would like to the same for a Task.

 

 

0 Kudos
Message 1 of 3
(3,244 Views)
Solution
Accepted by topic author HEG

Hi HEG,

 

> Is there any way to programatically know the properties of a given channel type?

 

Unfortunately, there is no direct way to query the supported/set properties for a given device, channel, or task.

 

Also, note that the property get functions like DAQmxGetAIMax() return values that have been coerced by DAQmx, not the original values that your program set them to: see Importing MAX Input Voltage Configuration into LABVIEW on the Data Acquisition Idea Exchange for more details about this.

 

> I am trying to create program that dumps the setting/properties of a channel to disk.

 

There is a way to dump the settings/properties of a task or channel to disk: use DAQmxSaveTask() or DAQmxSaveGlobalChan() to save the task or channel in MAX, then use NISysCfgExportConfiguration() from nisyscfg.h to export the MAX configuration to an INI or TXT file. Make sure the destination file name ends in ".ini" or ".txt" so the result is in a human-readable format, otherwise you end up with a binary file in NCE format. You can parse the resulting file as a very roundabout way of querying the supported properties and retrieving the original uncoerced property values. You can also import the contents of the file using NISysCfgImportConfiguration().

 

Property introspection would be a good suggestion for the Data Acquisition Idea Exchange.

 

Brad

---
Brad Keryan
NI R&D
0 Kudos
Message 2 of 3
(3,226 Views)

Hi Brad,

 

Thanks for your answer. I guess I will have to hardcode the properties.

 

Hernan

 

 

0 Kudos
Message 3 of 3
(3,219 Views)