National Instruments PCI-6503 DAQ Board

Found this PCI board installed in one of the unused PC towers. It provides 24 pins of digital IO. Pins operate at 5 volt levels.

The National Instruments documentation only mentions support for a Windows driver. Further investigation reveals that Linux supports the board out of the box (Ubuntu 16.04) using the comedi driver. Whilst the device drivers are installed by default, the client libraries are not. If you want to program the board you will need to install the libcomedi0 and libcomedi-dev packages.

The comedy driver installs device support under /dev. When I tried /dev/comedi0 was present.

#include <stdio.h>
#include <comedilib.h>
int main(void)
        comedi_t *cdev;
        int      rc;
        cdev = comedi_open("/dev/comedi0");
        if (!cdev) {
                return -1;
        // All pins as outputs
        for (int i = 0; i < 24; i++) {
                rc = comedi_dio_config(cdev, 0, i, COMEDI_OUTPUT);
                if (rc) {
                        return -1;
        // Write to PA0 and PA1
        comedi_dio_write(cdev, 0, 0, 0);
        comedi_dio_write(cdev, 0, 1, 1);
        return 0;

Compile your code:

gcc -Wall foo.c -L/usr/lib -lcomedi -o foo

Run your code:

sudo ./foo

Created Nov 2018 by Stephen Davies.

  • howto/ni-pci-6503/start.txt
  • Last modified: 2018/11/27 15:15
  • (external edit)