LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

How to measure the width of a digital pulse with 60usec precission

Hi,

I'm using LabWindows 8.0 with a NI PCI-6013 data adquisition card. I'm using the PING))) ultrasonic sensor to measure distance:

http://www.parallax.com/dl/docs/prod/acc/28015-PING-v1.3.pdf

The problem is, that it gives a pulse which is proportional to the distance measured. As it sends an ultrasonic burst at the speed of sound, it has a resolution of 60usec/cm. I need a precission of +-1cm so I need to measure that pulse width with a resolution of 60 usecs. In other words, I need to monitor the signal every 60 usec. The problem is that the timer's max frequency is 1KHz (1 ms resolution), which is way too low for my measurements. I only have experience in LabWindows with analog signals so maybe the answer is easier than I think.

So my question is, is there any way to measure this accurately? Maybe a plugin to allow higher timer frequencies? Is there any digital function that would solve this problem?

Thanks in advance.



0 Kudos
Message 1 of 5
(3,414 Views)
From what you are saying it seems that you are relying on the computer's clock to handle sensor measurements, which is basically an incorrect solution due to hardware limitations of the PCs. On the contrary, since you have a daq board to use, you must perform this measurement entirely inside the board.
 
According to PING documentation, "The PING))) sensor provides an output pulse to the host that will terminate when the echo is detected, hence the width of this pulse corresponds to the distance to the target." so your problem seems to reduce really to a pulse width measurement, a task usually demanded to board's counter.
Basically you can use PING pulse as a gate to drive a counter which counts only when the gate signal is high, and given the 20 MHz clock of internal timebase you should be able to measure the pulse width with adequate precision.
 
I suggest you to search inside samples folder for pulse width measurement daq examples which should give you a good starting point to develop your application.


Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 2 of 5
(3,404 Views)
Yeah I found it earlier but it wouldn't let me delate the thread. Thanks for the response by the way,
0 Kudos
Message 3 of 5
(3,401 Views)
You're welcome!


Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 4 of 5
(3,397 Views)

Hi both,

 

Yeah ROberto is right (great answer), The counter works with an internal counter of 20 MHz so it has more precission that the one u need. So you can use them for that. To make a continous measurement make a buffered (continous acquisition) and as Roberto says u can insert a clock on the gate of the counter.

 

Just take a look at the examples and try them,

 

Let us know for any other extra info/help,

 

Regards,

Jaime Cabrera

NI Applications Engineering Spain
0 Kudos
Message 5 of 5
(3,384 Views)