From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Digital I/O

cancel
Showing results for 
Search instead for 
Did you mean: 

NI 9401 open-collector output in Python

Hi, I'm setting up a test system interfacing to a 1V8 device to simulate button presses that normally pull to ground. So I was very happy to find that the IO's seem to be configurable using the DigitalDriveType.

Using advice from Open-Drain Configuraiton for USB-6000 with Python I was able to get the code working, but the IO's still don't behave like open-collector/drain ...

Setup code:

self.nidaqmx_simple_io = nidaqmx.Task()
self.nidaqmx_simple_io.do_channels.add_do_chan(digital_io)
self.nidaqmx_simple_io.do_output_drive_type = DigitalDriveType.OPEN_COLLECTOR

Any suggestions? Could of course be that the module just doesn't support this configuration - e.g. USB-6501 clearly states that 'open collector(open-drain)' is supported, but I can't find that for any C Series Digital Module's ...

Thanks in advance and best regards Jesper

0 Kudos
Message 1 of 2
(2,060 Views)

I have since done some testing on the USB-6501 and I'm able to set an output to open-collector mode, BUT it seems that the 4k7 pull-up resistor is permanently active - this is a bit surprising to me (see: https://www.ni.com/pdf/manuals/375268c.pdf).

There's an interesting value in the constants file, but I have not been able to guess how to apply it (if it's at all relevant for this device): 

class LogicLvlBehavior(Enum):
    PULL_UP = 16064  #: High logic.
    NONE = 10230  #: Supply no excitation to the channel.

Setup code found to work:

import nidaqmx
from nidaqmx.constants import DigitalDriveType

TEST_IO = 
"USB-6501/port0/line0"

with
 nidaqmx.Task() as task:
task.do_channels.add_do_chan(TEST_IO)
    for channel in task.do_channels:
channel.do_output_drive_type = DigitalDriveType.OPEN_COLLECTOR
    print(f'TEST IO Write: {task.write([FalseTrueFalseTrue], auto_start=True)}')
0 Kudos
Message 2 of 2
(1,929 Views)