Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

Help with NI-DAQ™mx Base 2.x C code for USB-6009 under Linux

Hello, I have just installed the drivers for the USB-6009 into my linux distro, and I am attempting to run the readDigPort example in /usr/local/natinst/nidaqmxbase/examples/dio.

When you make and try to run the program without any modification, you get this error message:

DAQmxBase Error -200170: Physical channel specified does not exist on this device.

I look at the code, and I see this:

   // Channel parameters
   const char  chan[] = "Dev1/Port0";

I change it to reflect the device port mapping per the user manual, to be this:

   // Channel parameters
   const char  chan[] = "Dev1/P0.1";

This changes the error message to this:

DAQmxBase Error -200430: I/O type of the physical channel does not match the I/O type required for the virtual channel you are creating.

The good news is that it seems I have managed to guess the port mapping. The bad news is that something in the driver thinks I don't have a digital I/O at P0.1. I tried a couple of other combinations of "legal" port names according to the user manual to no avail.

It seems that the USB-6009 is installed well; the light is happily flashing on it, and lsdaq returns this:

--------------------------------
Detecting National Instruments DAQ Devices
Found the following DAQ Devices:
NI USB-6009: "Dev1"    (USB0::0x3923::0x717B::01256EA6::RAW)
--------------------------------

So my questions are these:

1) Is there some explicit documentation on the mapping of port names? It's a little ambiguous reading the data sheet as to whether, for example, the port names are case-sensitive, if they require a space between the P and the port number, etc.
2) Is there a tested ANSI-C code example that someone can give me for reading and writing to the USB-6009? It seems that this example was written for a different device (since the port mapping isn't relevant to the USB-6009). Something that reads and writes digital ports as well as analog ports would be primo. I'd just like to sanity check this whole setup before moving on.
3) How does one, using the ANSI-C calls, configure the characteristics of the digital I/O ports? I see there are some knobs to turn (totem-pole versus open collector) outputs, but there is no API for that as far as I can see in the documentation.

thanks!

0 Kudos
Message 1 of 4
(3,424 Views)
Hey bunnie,

I tracked down a linux system and a USB-6009 so that I could help you out with the issue you seem to be having.  For starters, I plugged the USB-6009 in to the computer and did the following:

I ran lsdaq to confirm that it reads as Dev1
I opened the readDigPort.c file to ensure that
const char chan[] = "Dev1/port0";

I then entered the following

---------------------------------------------------------------
cd /usr/local/natinst/nidaqmxbase/examples/dio/
make
./readDigPort
---------------------------------------------------------------

which returned:
---------------------------------------------------------------
Data read: 0xFF
---------------------------------------------------------------

I ran this several times to confirm that it was working.  You should be able to specify the device by the same naming convention, ie: Dev1/port0.
"Dev1/P0.1" shouldn't work.

Try removing the 6009 and plugging it into a different port on the same machine. Perhaps even something as simple as restarting will help you out.  This error certain isn't expected and shouldn't be happening.  Let me know what you find...




Elijah Kerry
NI Director, Software Community
0 Kudos
Message 2 of 4
(3,392 Views)
Thanks for the response--I actually got on the phone with an apps engineer at NI and we found out the problem was I had the wrong firmware on the USB-6009--had to convert it from daqmx to daqmxbase using a hack that runs on windows XP.

Not an intuitive solution, but it works now per your example above!

0 Kudos
Message 3 of 4
(3,389 Views)
In case anyone else stumbles across this thread and wants to know how to switch the firmware on these devices, consult the following document:

Switching a USB-6008, 6009, or 6501 between NI-DAQmx and NI-DAQmx Base
Elijah Kerry
NI Director, Software Community
0 Kudos
Message 4 of 4
(3,386 Views)