Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

DaqmxGetPhysicalChanName parameters

Hey all,

 

Trying to get Physical Channel names from my connected DAQs using the ctypes package from Python. So far I can get the System Device names by:

nidaq = ctypes.windll.nicaiu

buf_size = 100

buf = ctypes.create_string_buffer('\000'*buf_size)

nidaq.DAQmxGetSysDevNames(buf, buf_size);

detected_devices = (buf.raw).split(", ")

 

Which returns a list of the System Devices: [Dev1, Dev3]

 

 

One step further I am trying to use DaqmxGetPhysicalChanName in a similar fashion by looking through the devices so that I can end up with something like:

Dev1/ao0

Dev1/ao1

Dev3/ao0

Dev3/ao1

Dev3/ao2

Dev3/ao3

 

When calling:

nidaq.DaqmxGetPhysicalChanName(TaskHandle(0), const char channel[] , buf, buf_size)

 

What am I supposed to be passing for const char channel[] ? Obviously a const char, but what would an example of that be?

 

Things I have tried:

nidaq.DaqmxGetPhysicalChanName(TaskHandle(0), 'Dev1' , buf, buf_size)       a python string 

Returns : -200088

nidaq.DaqmxGetPhysicalChanName(TaskHandle(0), ctypes.c_char_p("Dev1") , buf, buf_size)       equivalent to char*

 Returns : -200088

 

If I call this twice in a loop, the function also returns 00088.

 

Any help would be great. Keep in mind the end-goal is to be able to find each device, along with all of it's analog output channels names.

 

Thanks folks!

 

DL

0 Kudos
Message 1 of 5
(3,956 Views)

So I have at least gotten as far as figuring out that these returns codes mean something. Any documentation out there?

0 Kudos
Message 2 of 5
(3,949 Views)

Hi dlindema,

 

I do not know if you have seen these links before, but I think they could be useful, so just to be sure I am sharing them with you:

 

https://code.google.com/p/pylibnidaqmx/

 

http://python-in-the-lab.blogspot.com/p/blog-page.html

 

I hope they give you more tools to work with. 

 

Regarding the error codes you are getting, this is what I found:

 

error code -200088

Possible reason(s):

Task specified is invalid or does not exist.

 

error code 00088

Possible reason(s):

LabVIEW: Run-time menu error.

 

Regards

 

 

 

 

 

Message 3 of 5
(3,907 Views)

Hey thanks for the links!

 

I figured it out, and most of my problems come from my lack of C knowledge. Good reads though if anybody else stumbles into this.

0 Kudos
Message 4 of 5
(3,902 Views)

Hi dlindema,

 

I am glad you figured it out.

You are welcome.

 

Regards.

 

Ernesto

0 Kudos
Message 5 of 5
(3,884 Views)