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: 

FPGA (PXI-7852R) Phase Locked Square Wave DIO

Attached is a screen shot of a piece of code that creates square waves. Sadly, if the channels are set to different frequencies they are not phase coherent. Looking at all three square wave outputs with an oscilliscope and triggering on one of the channels I see that the other two channels are not "stationary", but rather moving relative to the channel with which I am triggering. 

 

How do I rememdy this issue? I would like the other channels to not move relative to the channel with which I am triggering no matter what frequency I set them to.

 

My thoughts are that I need to program a trigger into the FPGA code. Any thoughts?

 

Thanks in advance!

 

0 Kudos
Message 1 of 18
(3,151 Views)

Hi dthrash,

 

Are these frequencies exact multiples of each other?  Double check the Frequency (period/tick) calculation inside the Express VIs and make sure they are integer multiples. The drift from this offset would be consistent though, so that may not completely fix things.  Additionally, you should try placing each step of the parallel sections of code in a sequence structure; currently it looks like those steps might be getting out of sync at each iteration and introducing a bit of a phase difference.

0 Kudos
Message 2 of 18
(3,102 Views)

Thanks for your response Matt_L

 

I double checked frequencies and they are integer multiple of one another. I also added the sequence structure (pictured below). Sadly there was no improvement. 

 

Any other ideas? 

0 Kudos
Message 3 of 18
(3,095 Views)

What are your frequencies? Is it possible to generate them exactly from the 80 MHz clock?

 

Lynn

0 Kudos
Message 4 of 18
(3,085 Views)

Yes, exact submultiples would be fine for now. Just as long as they are phase matched

0 Kudos
Message 5 of 18
(3,077 Views)

I should have clarified earlier, but with the sequence structure can you try placing each element in a different frame?  So all of the cluster reads in one frame, the waveform generation steps in one frame (I think this step would have the greatest effect), and the outputs in the last frame.

0 Kudos
Message 6 of 18
(3,053 Views)

Matt

 

attached is my attempt to follow your instructions. Did I get it right this time?

 

Sadly with frequencies of 1 kHz and 20 kHz the relative phase was still not constant. 

0 Kudos
Message 7 of 18
(3,048 Views)

I would suggest using the frequency generator for the highest frequency signal, then downcount to get the other two signals.  For example, the 1 kHz signal would change on every 10th rising edge of the 20 kHz signal.  This would guarantee that both signals rise at the same time.  You could base the third signal off either of the other two signals.  You would want to trigger off the slowest signal to get phase matching on the faster signals.

 

Bruce

Bruce Ammons
Ammons Engineering
0 Kudos
Message 8 of 18
(3,036 Views)

Bruce,

Thanks for your suggestion. I dont have a lot of experience with programing pulse counters with LabVIEW FPGA. Can you point me towards any examples to get me started?

 

Thanks!

0 Kudos
Message 9 of 18
(3,021 Views)

Here is a block diagram that does what I suggested:

Downcount.png

I have attached this VI in LV 2013 format.

 

Bruce

Bruce Ammons
Ammons Engineering
Message 10 of 18
(3,010 Views)