Digital I/O

cancel
Showing results for 
Search instead for 
Did you mean: 

Time between rising and falling edges of digital signal

Hi,

 

How can I read the time difference between a rising edge in the CTR 0 B(PFI 1) channel and a falling edge in the CTR 0 B(PFI 0)? I am using a NI USB-6210 DAQ and the digital pulses come from a Keyence GT2-71D LVDT

 

Thanks 

0 Kudos
Message 1 of 9
(1,386 Views)

Sounds like a perfect use case for the counter measurement mode "Two Edge Separation Measurement".   It's pretty flexible -- you can configure the terminal and polarity for both the first and second edges.

 

 

-Kevin P

CAUTION! New LabVIEW adopters -- it's too late for me, but you *can* save yourself. The new subscription policy for LabVIEW puts NI's hand in your wallet for the rest of your working life. Are you sure you're *that* dedicated to LabVIEW? (Summary of my reasons in this post, part of a voluminous thread of mostly complaints starting here).
0 Kudos
Message 2 of 9
(1,348 Views)

Hi

 

It's the first time I am using digital inputs, that measurement mode might work, but: What do I use as minimum and maximum? and, as I have two channels, how do I set the edges I need to measure? Because I need the rise of the second channel, that rises after the first, and the falling of the first channel

 

Thanks

0 Kudos
Message 3 of 9
(1,339 Views)

Min and Max help DAQmx select a timebase to use to measure the interval time.  It will typically pick the fastest one (thus the finest time resolution) that lets it count up to the Max time without overflowing the (probably 32-bit) counter.  For your M-series device, as long as Max is less than 50-some seconds, it'll use the fastest timebase - 80 MHz.

 

To implement: start with a shipping example for counter input shown below.  Expand the property node that lets you identify the terminals for the first and second edges.  Then select the properties that let you define which edge to be concerned with (rising or falling) for each.

 

 

-Kevin P

 

image.png

CAUTION! New LabVIEW adopters -- it's too late for me, but you *can* save yourself. The new subscription policy for LabVIEW puts NI's hand in your wallet for the rest of your working life. Are you sure you're *that* dedicated to LabVIEW? (Summary of my reasons in this post, part of a voluminous thread of mostly complaints starting here).
0 Kudos
Message 4 of 9
(1,312 Views)

Hi,

 

I used that example as a base guide to build the VI that I attach. Can you tell me if if is doing the thing that appears on the image in the VI (Reading the rising of the second channel and the falling of the first)? Because there are numbers appearing but I don't know if they are correct.

 

Thanks

0 Kudos
Message 5 of 9
(1,287 Views)

Sorry, I can't open the attached vi.  Can you go to File->Save For Previous Version... back to LV 2018 or so?

 

 

-Kevin P

CAUTION! New LabVIEW adopters -- it's too late for me, but you *can* save yourself. The new subscription policy for LabVIEW puts NI's hand in your wallet for the rest of your working life. Are you sure you're *that* dedicated to LabVIEW? (Summary of my reasons in this post, part of a voluminous thread of mostly complaints starting here).
0 Kudos
Message 6 of 9
(1,232 Views)

Hi

 

I think now is in LV 2018 or 2017

0 Kudos
Message 7 of 9
(1,228 Views)

No, you need to expand the property node to define which edge (rising or falling) of the first signal *starts* the time measurement and which edge of the second signal ends it.   Otherwise the task will use default values for both, probably both rising or both falling.

 

I took your code, then chose Edit->Clean Up Diagram to make it more legible.  Then I added the things I mentioned above.  I also changed your file writing express vi to *append* rather than overwrite every iteration.  Give it another try.

 

 

-Kevin P

CAUTION! New LabVIEW adopters -- it's too late for me, but you *can* save yourself. The new subscription policy for LabVIEW puts NI's hand in your wallet for the rest of your working life. Are you sure you're *that* dedicated to LabVIEW? (Summary of my reasons in this post, part of a voluminous thread of mostly complaints starting here).
0 Kudos
Message 8 of 9
(1,203 Views)

Hi,

 

I gave it another try and it's not working, but I think it is not a problem with the LabView code, I think it's the LVDT that it's not working correctly or that I don't know how it works.

0 Kudos
Message 9 of 9
(1,120 Views)