LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Calculate time difference between two states of a boolean indicator

Hi,

I am acquiring a digital input through my 9401 module., using simple DAQmx Read polymorphic VI

The pin is called ERROR OUT Pin ; as whenever any error occurs that digital pin goes HIGH and when it is deactivated it goes LOW.

I want to calculate the time difference between these two events i.e.From Setting pin HIGH to going LOW .

Is it possible to calculate such difference by polling the same pin every 10ms? and how?

At the same time on detection of this Transition my VI execution should be stopped.

Currently, I am aborting my VI by using STOP button , which otherwise should be a triggered stop on detection of transition. 

Please find my VI attached herewith.

Any help would be highly appreciated.

 

Best Regards,

Snehal Upadhye

0 Kudos
Message 1 of 7
(3,681 Views)

There is a function called  Boolean Crossing Pt By Pt.vi that would be very useful to you here.  It can detect if your booean value changed.  So I would use that to detect when the line changes and store the time in a shift register.  When the line goes back low, subtract the saved time from the current time and you will have your pulse length.  You can also add a little more logic to stop your loop when the pulse goes back low.

 

This snippet shows you how to stop your loop on the falling edge.  See what you can do from here to get your pulse length.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 2 of 7
(3,677 Views)

Hi Crossrulz,

 

Thanks for the suggestion. I'll try this out.

 


 

So I would use that to detect when the line changes and store the time in a shift register


 

 

How would I do that?

I am not that familiar with Timing functions.

 

Best Regards,

Snehal Upadhye

 

0 Kudos
Message 3 of 7
(3,671 Views)
0 Kudos
Message 4 of 7
(3,668 Views)

Thanks Hooovahh for the reply.

 

But I know the concept of shift register.

I said I am not familiar with "Timing" functions; hence I don't know how to store a Timestamp of a  particular event in the shift register.

Which timing function can be used and how, is my concern.

 

Regards,

Snehal Upadye

0 Kudos
Message 5 of 7
(3,660 Views)

I didn't know about the Boolean Crossing VI.  Kudos!

---------------------
Patrick Allen: FunctionalityUnlimited.ca
0 Kudos
Message 6 of 7
(3,659 Views)

@SuLAB wrote:

Thanks Hooovahh for the reply.

 

But I know the concept of shift register.

I said I am not familiar with "Timing" functions; hence I don't know how to store a Timestamp of a  particular event in the shift register.

Which timing function can be used and how, is my concern.

 

Regards,

Snehal Upadye


You wire a timestamp into a shift register just like you'd wire any other datatype.

 

This thread really belongs in the LabVIEW forum, not breakpoint.

0 Kudos
Message 7 of 7
(3,652 Views)