Hi All, I'm using an NI-6509 / PCI card to generate encoder pulses. All we do is write to the outputs every 2ms. It seems the write is a blocking call, and when we check the min/max time for a write is varies from 0.1ms to 1ms, sometimes we even get write times up to 2ms, which causes some issues.
So I have 2 questions:
1. Is there a way to make this call "non-blocking"
2. Why does the call take so much time
Here is the Python code to create the task:
def__init__(self😞
try:
self.OutputStates = [False,False,False,False,False,False,False,False] # NI DAQ port 0 initial
# Configure and setup the tasks
self.task0 = nidaqmx.Task()
self.task0.do_channels.add_do_chan("Dev2/port0/line0:7" ,line_grouping=LineGrouping.CHAN_PER_LINE)
self.task0.start()
# set default values
self.task0.write(self.OutputStates)
exceptExceptionase:
self.task0 = None
print("NationalInstrumentGpio::__init__() exception: {}".format(e))
Here is the write method, called every 2msec
defWriteOutputs(self😞
try:
self.task0.write(self.OutputStates)
exceptExceptionase:
print("NationalInstrumentGpio::SetOutputState() exception: {}".format(e))
raiseNationalInstrumentGpioException("NationalInstrumentGpio::SetOutputState() exception: {}".format(e))