07-31-2022 07:13 PM
I want to capture a timestamp every time a sample passes through my photo-sensor. I have a system in which I have connected the digital output of my photo-sensor to a digital input channel. I am monitoring the digital line using a DAQmx task with Change Detection event registration, derived from this example: https://knowledge.ni.com/KnowledgeArticleDetails?id=kA00Z0000004AvPSAU&l=en-US
The issue I am seeing is that I am acquiring more "change events" than I expect. My hypothesis is that the change detection code is not "re-arming" after the first change has been detected, and DAQmx proceeds to just sample at the rate of the while loop. The reason I think this is because when I hold my finger in the photo-sensor for 0.5-1sec, I am logging >20 timestamps, each of which should be tied 1:1 with a change event.
Does anyone have any experience with this use case? I am curious if I could make some changes in my code to "re-arm" the change detection task.
07-31-2022 10:15 PM