10-12-2022 09:02 PM
I have the following python code from a framework that registers timestamps on callback for digital high on a specific line using NIdaq cards:
self.lv_task = nidaqmx.Task("read_behavior_ttl")
self.lv_task.di_channels.add_di_chan(lv_chan)
self.lv_task.timing.cfg_change_detection_timing(rising_edge_chan=lv_chan)
self.lv_task.register_signal_event(nidaqmx.constants.Signal.CHANGE_DETECTION_EVENT, self.lv_interrupt)
self.lv_task.start()
However, the only card we have on our lab is the good-for-nothing NI USB-6105, which can't do change_detection. I was wondering if there is any way to adapt this to use the On_Demand mode to record these timestamps with the system clock.
Thanks in advance!
10-12-2022 10:09 PM
You can continuously read the digital line state in a loop, and detect the line state change and store the system timestamp
10-13-2022 12:12 AM
Thank you for the support.
My code, however, includes a constant acquisition of camera frames, so I think putting a loop there would hang the rest of the functions. Is it possible to use a callback when a digital high is detected?