Digital I/O

cancel
Showing results for 
Search instead for 
Did you mean: 

select type drive Digital Output NI USB 6501 Python

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 :

Mat1987_1-1612186897586.png

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

 

 

0 Kudos
Message 1 of 6
(2,917 Views)

I found this also :

https://nidaqmx-python.readthedocs.io/en/latest/do_channel.html#nidaqmx._task_modules.channels.do_ch...

 

but it does not run with task.do_channels.do.output_drive_type :

0 Kudos
Message 2 of 6
(2,912 Views)

It could be that you cannot set individual pins as open collector or active driver but rather only the entire port.

santo_13_0-1612193723144.png

https://www.ni.com/pdf/manuals/375267a.pdf

 

The driver might have the features but it will be limited by the actual hardware used.

 

 

Santhosh
Soliton Technologies

New to the forum? Please read community guidelines and how to ask smart questions

Only two ways to appreciate someone who spent their free time to reply/answer your question - give them Kudos or mark their reply as the answer/solution.

Finding it hard to source NI hardware? Try NI Trading Post
0 Kudos
Message 3 of 6
(2,888 Views)

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... 

 

0 Kudos
Message 4 of 6
(2,876 Views)

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 

0 Kudos
Message 5 of 6
(1,357 Views)

For clarity, LabJack devices do have individually controllable tri-state digital I/O and Python is commonly used with our devices.

 

https://labjack.com/pages/support?doc=/datasheets/t-series-datasheet/130-digital-io-t-series-datashe...

 

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.

 

0 Kudos
Message 6 of 6
(1,339 Views)