05-26-2018 07:14 AM - edited 05-26-2018 07:20 AM
Solved! Go to Solution.
05-27-2018 08:43 AM
I don't know of a direct solution for this problem. All I've found to do was to first set up an unclocked DI task to take a sneak peak at the initial state, then stop and reconfigure the task for change detection.
This can work fine if you have control or knowledge that the state won't change between your sneak peak and the time it takes to reconfigure the task for change detection. Without that guarantee, I don't know of a clean solution.
Maybe you should post this idea to the Data Acquisition Idea Exchange? It might be possible to add a DAQmx property that would allow you to retrieve the initial state just prior to the first change.
Anyone out there have a better method? If so, please educate us...
-Kevin P
05-28-2018 10:13 AM
05-28-2018 03:51 PM
One way or another, it'd be good to be able to know the initial state.
I tend to prefer something like the property node solution so it's available to the programmer that needs it but doesn't get in the way for the programmer that doesn't. I tend to do stuff where tasks get sync'ed to one another with a common sampling clock signal, and if the DI task got an extra sample or extra event, it'd tend to throw things off. It's easy enough to code around that, but the code needed to *prevent* throwing things off is no simpler than the code needed to know when to query the property node I proposed.
-Kevin P