02-01-2021 07:50 AM
Hi all,
I want to configure output per output of my IO card. for example I want output p1.0 to be active drive and p1.1 to be open collector. I can’t figure out how to do that in python.
I found this on internet :
and this is my soft :
Active_Drive = 12573
Open_collector = 12574
import nidaqmx
task = nidaqmx.Task()
nidaqmx.constants.DigitalDriveType(Active_Drive)
task.do_channels.add_do_chan("CarteIO/port0/line0")
task.start()
value1 = False
print('Valeur de la sortie :', value1)
task.write(value1)
task.stop
task.close()
I can’t select each output. I think I’m missing a few simple things but I tried a lot of things, I don’t see.
I also tried to add direction of port, or other things but i don't see.
Do you have an idea ?
Thanks
02-01-2021 08:13 AM
02-01-2021 09:38 AM
It could be that you cannot set individual pins as open collector or active driver but rather only the entire port.
https://www.ni.com/pdf/manuals/375267a.pdf
The driver might have the features but it will be limited by the actual hardware used.
02-01-2021 12:12 PM
Thanks for your answer,
I thought like you, but I tried via labview or ni max and it is possible to individually select the outputs. I think it’s because I don’t use python drivers properly...
11-16-2023 08:44 AM
Terible waste of time, no working example in Python, been desperate to use NI product, but at the end is expencive, difficult hard to implement not complete product, go back to LabJack, no time for empty examples and some amaters half solutions
11-16-2023 12:04 PM
For clarity, LabJack devices do have individually controllable tri-state digital I/O and Python is commonly used with our devices.
Input: Terminal is connected to 3.3V through a 100 kΩ pull-up resistor.
Output-high: Terminal has a low impedance connection to 3.3V.
Output-low: Terminal has a low impedance connection to GND.
The terms open-collector, open-drain, NPN, and PNP are use to describe certain types of digital signals. These signals change between open & ground or open & high, rather than ground & high like you get from a push-pull signal. The various terms are used somewhat loosely, and often all variations are simply called "open-collector", but following is the most common usage:
Open-collector = NPN = Changes between open and low.
Open-drain = PNP = Changes between open and high.
Note that when you change LabJack digital outputs between output-low and output-high, that is a push-pull (aka driven) signal. For example in Python on a T-series device:
ljm.eWriteName(handle, "DIO4", 0) # Set DIO4 to output-low.
ljm.eWriteName(handle, "DIO4", 1) # Set DIO4 to output-high.
To act like an open-collector NPN output you actually want to change our outputs between output-low and input.
ljm.eWriteName(handle, "DIO4", 0) # Set DIO4 to output-low.
state = ljm.eReadName(handle, "DIO4") # Set DIO4 input and read state.
The code for LabVIEW and any other language would be similar.