Counter/Timer

cancel
Showing results for 
Search instead for 
Did you mean: 

40kHz ultrasonic pulse and time it take to receive the Pulse.

Solved!
Go to solution

Hi,

 

 i have developed  the following circuits:

 

Tx: a Circuit that generates a 40kHz frequency using an LM555, the LM555 is wired to an AND gate which when using the test panel on MyDAQ(6216) i set cntr0 and set it to edge detecting i can count the number of edge detections when i enable the port High and when i switch it low it stops recording the counts.

 

Rx: Recieving circuit contains an OpAmp which is fed into an LM567CN tone decoder which is tuned to 40Khz. when the recieving circuit PLL locks on to the 40kHz signal the output of the LM567 pin 8 switches to ground.

 

Question: I am very new to NI and wondering where the starting point would be to create a VI that will trigger the Tx circuit and then measure the time it takes the Rx circuit to recieve the signal, this will intitial be done through air and then i would like to move it through a meduim such as water. Has  anyone tried or seen anything that would be of use to create a vi that would match this.

 

Any help would be greatly appericated.

 

Phil

0 Kudos
Message 1 of 4
(5,402 Views)
Solution
Accepted by topic author pnulty

Are you using a myDAQ or a 6216?  You mentioned both... I'm going to assume 6216:

 

 

You'll want a two edge separation task, and also a digital output task.  

 

The digital output will control the enable signal for the LM555.  Connect it from the digital output line to your AND gate as well as to one of the PFI lines on the 6216 (it will be the "first" edge).  Connect pin 8 of the LM567 to a different PFI line on the 6216 (the "second" edge). You can configure rising/falling polarity via the Create Channel VI (it sounds like your second edge will be "falling").

 

Programming would be as follows (in order):

 

1.  Configure the tasks as shown in the linked examples (i.e. create channel / configure timing).

2.  Start the digital output task.

3.  Write the digital output "low" to make sure it is initialized.

4.  Start the two edge separation task (it should be buffered like in the linked example even though you are only reading one sample).

5.  Write the digital output "high".

6.  Read (one sample) from the two edge separation task.  Specify a read timeout long enough to ensure the falling edge is seen.

7.  Write the digital output "low" (assuming you want to turn off the Tx when you are done with the test)

8.  Stop and Clear both tasks.

 

The measured result will have a 12.5 ns resolution using the default 80 MHz timebase on the 6216.

 

 

Best Regards,

John Passiak
0 Kudos
Message 2 of 4
(5,383 Views)

Hi John,

 

Thank you for taking the time to reply back, i had some trouble with my circuits which i have just resolved however i am now at a loss with labview still. . Yes you are correct  usb-6216 is what i am using.

 

 I have tried to set up but am having difficulty matching the documentation to the method i am trying to use, using A Flat Sequence Structure and calculating time. set up of pins below on 6216

 

      Cntr0 (DI/O 44) and PFI12 (DI/O 38) to the and GATE 1A and 1B, 1Y is connect to Pin 3 of the LM555 output. which is set up to 40kHz.

      Cntr1 (DI/O 39) PFI13 which is connected to the Output of LM567 which is pin 8.

 

 

1. I am trying to calculate the DAQ Output of the LM555 and calculate the time it takes to reach the LM567 and for it to swicth to low. I know this will be in the microseconds range take the two time measurements and calculate the difference,

 

Can you help fill in the blanks of what Digital outputs to use when i use the DAQ assistant i get to confused, any text books i have do not cover this scenario.

 

regards

philip

 

 

0 Kudos
Message 3 of 4
(5,330 Views)

I'm actually still using LV 2011 on this computer so I can't open your VI, but it doesn't sound correct...

 

You need to break up the configuration/starting of the tasks and the reads like I described above, and you can't do this with the DAQ Assistant.  Use the lower-level DAQmx API as shown in the examples I linked previously.

 

The flat sequence structure shouldn't be necessary, you can ensure the correct execution order by chaining the error wires.

 

 

Best Regards,

John Passiak
0 Kudos
Message 4 of 4
(5,318 Views)