Driver Development Kit (DDK)

cancel
Showing results for 
Search instead for 
Did you mean: 

pcie6509 port configure as input and output

Can I change the configuration of some ports from input to output and vice versa when a program is running? I'm using the MHDDK on Linux

 

0 Kudos
Message 1 of 2
(4,306 Views)

You should be able to do this. You will need to stop the current action then do a port reset and reconfigure the direction. Here is a section of code from dioex2.cpp that could be useful to reference:

 

   for (portIterator = ports.begin(); portIterator != ports.end() && status.isNotFatal(); ++portIterator)
   {
      (*portIterator)->reset(NULL, 0, status);
   }

   //
   // Program lines for input
   //

   for (portIterator = ports.begin(); portIterator != ports.end() && status.isNotFatal(); ++portIterator)
   {
      (*portIterator)->configureLines(lineMask, nNISTC3::kInput, status);
   }

   if (status.isFatal())
   {
      printf("Error: Cannot program digital subsystem (%d).\n", status.statusCode);
      return;
   }

Instead of using the portIterator to iterate through all of the available ports, select the specific ports you want to change and do the reset and configureLines function calls on those. Also take a look at dioex1.cpp to see how to configure the ports for digital output. It is a similar process.

Steven K.
National Instruments
Software Engineer
0 Kudos
Message 2 of 2
(4,028 Views)