Digital I/O

cancel
Showing results for 
Search instead for 
Did you mean: 

Need help with NI-USB6501 and inverting lines of a DI channel

Hi,

 

I'm trying to achieve the following and not sure how to.

 

My interface with the outside world is giving me 5V when i need to detect something as active when calling the DAQmxReadDigitalLines function. But all lines are indicating 5V when inactive by default, so I can not detect the 5V from the outside world, since the device is expecting 0V from the outside world to make the distinction.

 

Here 's an example while reading 5 lines and wanting to detect a difference on line 5:

 

Current scenario:

 

  • Line1: 5V (inactive)
  • Line2: 5V (inactive)
  • Line3: 5V (inactive)
  • Line4: 5V (inactive)
  • Line5: 0V (active) ==> my software detects the 0V and does something with it

 

Desired scenario:

 

  • Line1: 0V (inactive)
  • Line2: 0V (inactive)
  • Line3: 0V (inactive)
  • Line4: 0V (inactive)
  • Line5: 5V (active) ==> my software detects the 5V and does something with it

 

This would greatly simplify my application. Is the DAQmxSetDIInvertLines function the way to do this? It does not seem to have the correct effect when I'm trying to test it.

 

Can someone help me with this. Does anyone have sample code of this DAQmxSetDIInvertLines function? I've checked all c-reference help there is, checked for sample code, but nothing..

 

Code snippet that i'm using:

 

DAQmxCreateDIChan(taskHandle, "Dev1/line0,Dev1/line1,Dev1/line2,Dev1/line3,Dev1/line4,Dev1/line5", "DICHAN", DAQmx_Val_ChanForAllLines);
DAQmxSetDIInvertLines(taskHandle, "DICHAN", TRUE);

 

Thank you in advance,

 

Sander

0 Kudos
Message 1 of 1
(906 Views)