From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Digital change detection can not catch the last digital change???

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

0 Kudos
Message 1 of 7
(2,428 Views)

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 

0 Kudos
Message 2 of 7
(2,414 Views)

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

0 Kudos
Message 3 of 7
(2,392 Views)

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.

0 Kudos
Message 4 of 7
(2,378 Views)

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,

0 Kudos
Message 5 of 7
(2,365 Views)

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.

 

 

Digital Event Detection_2.JPG

0 Kudos
Message 6 of 7
(2,360 Views)

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,

 

 

0 Kudos
Message 7 of 7
(2,355 Views)