LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

acquire sine wave from DAQ

Hi
I am using DAQ to acquire sine wave from function generator to determine the fringes, phase and wavelength.
 
How can I build this VI?
 
Thank you
0 Kudos
Message 1 of 12
(4,006 Views)
Try searching for "Introduction to Taking an NI-DAQmx Measurement in LabVIEW" in the LabVIEW Help.  There is a decent article documenting how to get started with DAQ in LabVIEW.
0 Kudos
Message 2 of 12
(3,993 Views)
Now I have sine wave in the chart, how can I count the fringes of the wavefrom?
0 Kudos
Message 3 of 12
(3,967 Views)
I assume you are looking for a peak detector of sorts.  There are VIs included in LabVIEW, if you search for 'Peak' you should find a few.  You can also create your own algorithm of detecting peaks using VIs from the 'Comparison' palette.
0 Kudos
Message 4 of 12
(3,957 Views)

yes, I need to know the peak and what is the phase at that point.

I am be able to get every peak of sine wave, but phase has positive and negative.

What I need is, for a continuous sine wave, the phase is increasing, like 0, pi/2, pi, 3pi/2, 2pi.....etc..

for example, at time t1, what is the peak and  phase, t2, the peak and phase.

thank you

0 Kudos
Message 5 of 12
(3,936 Views)

Here is my VI:

Please make some corrections to it

DAQ.vi

0 Kudos
Message 6 of 12
(3,927 Views)

Mostly like the phase is being reported from 0 to 180 or 0 to -180.  There is a VI to unwrap the phase.

 

I took a look at your code and I am a bit confused about what you are trying to do.  Right now it looks like you are gathering 100k samples at a sampling frequency of 200k in a finite acquisition.

In your code, each iteration of the For loop takes 100k samples and finds the number of peaks.  The Extract Single Tone Information.vi finds the tone with the largest amplitude in the 100k samples and returns the amplitude and phase.  The phase in this case returns the absolute (start) phase of your detected sine tone, that can also be viewed as the phase relative the beginning of your signal (in this case the beginning of the 100k samples).

 

On the next iteration, the code takes a new set of 100k samples and calculates the same information (again the phase is based on the start of this new set of 100k samples).

What is your ultimate goal?  To continuously acquire data, find peaks and their phase relative to the first sample collected? To acquire a finite set of data, and find the phase of each peak relative to the first sample?  Get the relative phase between two different peaks?  What are you using the phase information for?  Are you using the phase to count the number of cycles?  What kind of signal is coming from your signal generator?

 

To compare the phase to the first sample you will need to use some comparison vi’s as mentioned in another post.  Shift registers can be used to keep a “running” total of the phase from the first sample.

Jared T.
0 Kudos
Message 7 of 12
(3,892 Views)

I am doing a Fabry-Perot sensor project. Before that I need to do some stimulations by using sine wave (analog signal) generated from function generator on NI ELVIS.

I need to be able to know the peaks of sine wave and the phase of each peak.

For FP sensor, if I know the phase changes, I will know the displacement of gap increase or decrease.

For sine wave, If I know one peak and its relative phase compare to another peak and its phase, I will know the phase changes between two peaks.

I hope I expleained it right.

 

thank you for your helping.



Message Edited by ChienH on 02-11-2008 03:17 PM
0 Kudos
Message 8 of 12
(3,886 Views)

Hi ChienH,

I did some more looking and a found an example program that was used by a user trying to read in data taken from a fabry perot cavity.  Like you he wanted to find the distance between two consecutive peaks.

The example program attached has three files (inside the zip file): peak in.txt, peaks out.txt, Advanced Peak Detector (Amplitude and Position).vi.

The VI reads in pre-recorded data from peaks in.txt then finds the amplitude and distance between each peak and saves the data in peaks out.txt.  There is Boolean control on the front panel to specify how many channels to turn on for processing.  The example was written for 6 channels, but can be easily modified to include more.  The block diagram of the VI has some good explanations about the important parameters for the processing.

You should be able to take the code in this example and modify it for your needs.

Hope this helps.

Jared T.
0 Kudos
Message 9 of 12
(3,866 Views)
Hi.,
 
My labview 8 can not read 8.5 version. Can you picture the diagram of VI?
 
thank you so much
0 Kudos
Message 10 of 12
(3,849 Views)