12-08-2011 06:12 PM
I wrote a program to detect the digital change events and the time of the digital event. But the last digital change can not be caught. Can anyone help me to see what's the problem?
The program is attached
Thanks,
ossoo
12-09-2011 11:00 AM
Hey there,
I have looked through your code and I am a little surprised that it is missing the last sample. Would I be able to get some clarification, As I read this I was curious if the Counter is always just one count behind? Would your counter be able to detect the the Last digital edge if you added 4-5 more onto the end? Do you know if it just seems to miss some odd number of counts in the program?
Daniel
12-13-2011 08:03 PM
Hi Daniel,
We'll have 12 digital changes. My obervation is like this:
The Change Detection for Digital Input Tasks is good. It can detect all the digital changes.
But the Counter sometimes miss the last digital changes. The last digital change is a falling edge. And the last one is element #11.
I have no idea why this heppened.
Thanks,
Yanan
12-14-2011 11:02 AM
Going through your code I like the way it is setup and I am confused because it works on my computer and does not miss anything. (I am using my own port lines that match with my hardware) I think there is one thing that may help though. . . you may be missing this last data point because you are not reading samples fast enough in your main While loop. If you could try to take multiple points at a time like in the Example "Read Dig Chan-Change Detection.vi" in our example finder I would try that. Let me know if that works.
12-14-2011 05:11 PM
Hi Danial,
Actually, in my measurement, there is also an Digital Output Task before the while loop, which I deleted in the last code just to make the code looks clean.
So do you think this DO task disturb the counter? Or the position of the DO task is wrong?
I attached the real code that I use to measure in the attachment.
Thanks,
12-14-2011 06:38 PM
Hi Danial,
This is the result I get when I run the code in my environment.
The last digital change is catched by DI channel, but not by counter.
12-14-2011 09:28 PM
Hi Danial,
There might be one reason.
When the time interval between two digital changes are very short, such as 150ns. It seems that the counter did not arm the second digital change. What is the reaction time for the counter to arm?
Thanks,