LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Phase Shifting of 2nd Signal Relative to 1st Signal

Hello all,

 

I have two signals coming into NI 7841R through AI0 and AI1 and out through AO2 and AO3. These signals are visualized on a standalone oscilloscope through AO2 and AO3. I want to phase shift the 2nd signal from the front panel and should be able to visualize 2 signals separated by the phase inputted into the phase control. Also, the 2nd signal has a higher frequency so I want to a single instance of it during the positive half cycle.

 

I don't know how to get these and will need the assistance of the LabVIEW community.

 

So far, my code can detect the rising phase of the 1st signal which is a sine wave however I am unable to get the phase shift and also unable to output just 1 square wave instead of 3 as shown in the attached file.

 

Please help.

 

 

0 Kudos
Message 1 of 10
(750 Views)

Any help on this yet?

 

I would appreciate your assistance.

 

Thank you.

 

 

0 Kudos
Message 2 of 10
(685 Views)

Am I doing something wrong in the community?

 

I keep seeing the number of views going up but no help.

 

I have tried to solve the issue with the use of shift registers but to no success.

 

I will appreciate any help given.

 

Thank you.

0 Kudos
Message 3 of 10
(647 Views)

Hi Lawrence,

 


@lquarshie wrote:

I don't know how to get these and will need the assistance of the LabVIEW community.


You should know how to get the required data: atleast you should know the math behind…

 


@lquarshie wrote:

So far, my code can detect the rising phase of the 1st signal which is a sine wave however I am unable to get the phase shift and also unable to output just 1 square wave instead of 3 as shown in the attached file.


Your code does not detect the "rising phase" of the sine wave, it detects "positive values": quite a difference! (As written before: you should know the math behind your algorithm!)

 

To determine "phase shift" of two signals you need to determine their "zero crossing" (or a similar detectable) event and compare the timestamp of those events with respect to the wave period: again I suggest to "know the math behind the algorithm"!

 

Right now your test VI contains just a bunch of ExpressVIs and some very questionable constructs using DDT wires: I recommend to stay away from ExpressVIs and DDT wires as long as you don't know LabVIEW very good. DDT wires hide too many information!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 4 of 10
(636 Views)

Phase shift for two different frequencies is never constant 😉

 

If you have more that one frequency in your signal (incl. harmonics) the zero crossing detection doens't have to be a measure for the phase of (the base?) a frequency.

 

extract tone vi would be a better way IMHO

 

 

Greetings from Germany
Henrik

LV since v3.1

“ground” is a convenient fantasy

'˙˙˙˙uıɐƃɐ lɐıp puɐ °06 ǝuoɥd ɹnoʎ uɹnʇ ǝsɐǝld 'ʎɹɐuıƃɐɯı sı pǝlɐıp ǝʌɐɥ noʎ ɹǝqɯnu ǝɥʇ'


0 Kudos
Message 5 of 10
(631 Views)

Thank you very much for your response. 

 

I tried using the math functions to implement the phase shift between the signals but realized not all LabVIEW functions work on the FPGA.

 

I have been going through several materials to understand all the necessary algorithms to get the desired outcome.

 

I appreciate you making time to respond to my question.

0 Kudos
Message 6 of 10
(614 Views)

So I know I can do a phase shift with first of all knowing the frequency of the sine wave and then multiplying the phase (angle) / 360 and that's gonna give me the time difference. However, I am unable to do this because there division block is not supported on the FPGA.

 

Can you help with the best way to implement this? What are the blocks that will be required?

 

Thank you,

0 Kudos
Message 7 of 10
(587 Views)

Hi l,

 


@lquarshie wrote:

multiplying the phase (angle) / 360 and that's gonna give me the time difference.

However, I am unable to do this because there division block is not supported on the FPGA.


Division is supported on FPGA, but takes a lot of resources.

Did you know that division by x is the same as multiplying by the inverse of X? (Basic math…)

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 8 of 10
(580 Views)

Thank you very much. I have been able to implement the division operator using the inverse of the number.

 

However, I am still struggling with implementing a phase shift between the two waves. I have tried several examples from the community using shift registers but not working.

 

Currently, I am working on generating a sequence of two waveforms with time delay and feeding it into the analog output AO but it also isn't working.

 

Still need help to figure out this.

 

Thank you!!!

0 Kudos
Message 9 of 10
(566 Views)

Hello sorry for asking so many questions and it's because I am new to FPGA and LabVIEW.

 

I found a book I believe will be helpful called "Digital Signal Processing Laboratory: LabVIEW-Based FPGA Implementation".

 

I have placed an order for this book but the delivery is next week Friday.

 

Is anyone here having a soft copy of the book that they are willing to share?

 

I will appreciate that.

 

I want to be good with LabVIEW so I don't have to ask the community all these questions.

 

Thank you!!

0 Kudos
Message 10 of 10
(543 Views)