Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

callback on 'on_demand' timed digital input

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!

0 Kudos
Message 1 of 3
(1,094 Views)

You can continuously read the digital line state in a loop, and detect the line state change and store the system timestamp

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
Message 2 of 3
(1,068 Views)

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?

0 Kudos
Message 3 of 3
(1,039 Views)