Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

NI6501 Python NIdaqmx

Hello,

 

It's seems to have bug in module nidaqmx in python to control the channel in output

The read function for channel configurate in output digital seems to work only for port0/line0:3

 

I'm not sure but it's seems that moreover the output digital comes is replaced by a input digital when a read is performed.

if you launch my program below you will see that

print(f"do_read : {do_read}") indicate 15,, so only the port0/line0:3 is changed and on the board NI6501, the situation is confirmed

 

If you remove the line " read" from the code, all ports, port0/line0:5 is modify on board

 

I see also that the nidaqmx has not been updated until 2017. Is it normal ?

 

import nidaqmx
from nidaqmx.constants import LineGrouping

dev_str = "Dev1/port0/line0:5"
# nidaqmx.do_output_drive_type = nidaqmx.constants.DigitalDriveType.OPEN_COLLECTOR
with nidaqmx.Task() as task:
task.di_channels.add_di_chan(dev_str, line_grouping=LineGrouping.CHAN_FOR_ALL_LINES)

with nidaqmx.Task() as task:
task.do_channels.add_do_chan(dev_str, line_grouping=LineGrouping.CHAN_FOR_ALL_LINES)
# task.do_channels.do_overcurrent_limit = 0.0001

# print(f"Drive type avant : {task.do_channels.do_output_drive_type}");
for chnl in task.do_channels:
# chnl.do_output_drive_type = nidaqmx.constants.DigitalDriveType.ACTIVE_DRIVE
chnl.do_output_drive_type = nidaqmx.constants.DigitalDriveType.OPEN_COLLECTOR
print(f"Drive type après : {chnl.do_output_drive_type}");

task.start()

task.write(15+32+16)
print(f"do_write ");
# print(f"do_is : {do_is}");
do_read = task.read(number_of_samples_per_channel=1)
print(f"do_read : {do_read}")

0 Kudos
Message 1 of 1
(120 Views)