# LabVIEW

cancel
Showing results for
Did you mean:

## how to calculate the phase difference between two square wave (acquired from two channel in one DAQ)

Hello everyone ,

I need a quickly help that as below :
I am trying use PCI-6220 to acquired six signals from one rotation encoder (channel A, channel B,channel Z ,and their non-signals) .The encoder out signals will be square wave and 4000pulses per revolution. I set it rotation at 300rpm speed. I need show every square wave of six out channels in waveform and measure the A-B phase difference to check if the value is correct (designed value should be 90deg) .
I have no idea how to measure or calculate the phase difference of two square wave base on synchronizate to acquire these two square wave from two channel on the PCI-6620....

Anyone can give a idea how to calculate the phase difference with two square wave ?

Thank a lot and Thanks again...

Tim
Message 1 of 11
(5,486 Views)

## Re: how to calculate the phase difference between two square wave (acquired from two channel in one DAQ)

Tim,

Locate the rising edges of both A and B by sample array index numbers. Find the difference in index for successive samples of A. Find difference in index for an A edge and the next B edge. Divide by the difference in A. Result is fraction of period. To get phase in degrees multiply by 360.

Lynn
Message 2 of 11
(5,480 Views)

## Re: how to calculate the phase difference between two square wave (acquired from two channel in one DAQ)

Lynn,

Thank you for your response , But I have a little confuse on how to locate the rising edages of both A and B by sample array index numbers. can you give me a program that  demonstrate what you show me ...Please.

Thank you very much

Tim
Message 3 of 11
(5,472 Views)

## Re: how to calculate the phase difference between two square wave (acquired from two channel in one DAQ)

Tim,

What version of LV are you using?

Lynn
Message 4 of 11
(5,460 Views)

## Re: how to calculate the phase difference between two square wave (acquired from two channel in one DAQ)

Lynn,

Labview8.2 full .

Thanks again

Tim
Message 5 of 11
(5,457 Views)

## Re: how to calculate the phase difference between two square wave (acquired from two channel in one DAQ)

Tim,

Here is a simple rising edge detector for one channel.

Lynn
Message 6 of 11
(5,449 Views)

## Re: how to calculate the phase difference between two square wave (acquired from two channel in one DAQ)

Thank you very much !!!

Thanks again .

Tim
Message 7 of 11
(5,445 Views)

## Re: how to calculate the phase difference between two square wave (acquired from two channel in one DAQ)

hi, sorry to bother, but my labview version is 8.0, so i cant open this VI 😕

i wonder if you guys cant post the picture (jpeg or whatever) of this vi

thanks a lot

see'ya
Message 8 of 11
(5,430 Views)

## Re: how to calculate the phase difference between two square wave (acquired from two channel in one DAQ)

Here is an 8.0 version.

Lynn
Message 9 of 11
(5,424 Views)

## Re: how to calculate the phase difference between two square wave (acquired from two channel in one DAQ)

Hi Lynn,

Can you also add further for finding phase difference from two channels ?

Thanks in anticipation.

Message 10 of 11
(2,434 Views)