From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead 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
0 Kudos
Message 1 of 11
(6,943 Views)
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
0 Kudos
Message 2 of 11
(6,937 Views)
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 
0 Kudos
Message 3 of 11
(6,929 Views)
Tim,

What version of LV are you using?

Lynn
0 Kudos
Message 4 of 11
(6,917 Views)
Lynn,
 
   Labview8.2 full .
 
Thanks again
 
Tim
0 Kudos
Message 5 of 11
(6,914 Views)
Tim,

Here is a simple rising edge detector for one channel.

Lynn
Message 6 of 11
(6,906 Views)
Thank you very much !!!
 
Thanks again .
 
 
Tim
0 Kudos
Message 7 of 11
(6,902 Views)
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
0 Kudos
Message 8 of 11
(6,887 Views)
Here is an 8.0 version.

Lynn
0 Kudos
Message 9 of 11
(6,881 Views)

Hi Lynn,

 

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

 

Thanks in anticipation.

 

 

0 Kudos
Message 10 of 11
(3,891 Views)