# LabVIEW

cancel
Showing results for
Did you mean:

## MyRIO FPGA: How can I implement an unwrap phase algorithm on an FPGA target?

Hello.

I have a phase detector in a phase-locked loop, and I want to track a specific value of the phase that happens to occur on resonance. However, I believe that I would need to unwrap the phase to do this. How can I do this on the myRIO's FPGA target?

So far, I have tried converting the Double data types in the "Unwrap Phase PtByPt VI " to FXP, but it doesn't seem to work. I know how to do it on the RT, but I want to do it directly on the target FPGA.

- Thank you

Message 1 of 3
(77 Views)

## Re: MyRIO FPGA: How can I implement an unwrap phase algorithm on an FPGA target?

So, besides "it doesn't seem to work", do you have any details on what way it is not working?

Perhaps even post your modified code so that others can see if anything is obviously wrong with it?

Message 2 of 3
(34 Views)

## Re: MyRIO FPGA: How can I implement an unwrap phase algorithm on an FPGA target?

Is the FPGA "acquiring" the Phase?  Since most instruments report their values as integers, you should be able to "unwrap the phase" by simply the Quotient and Remainder function in the FPGA.  The Quotient would be whatever (integer) value corresponds to two-pi in your system.  You may want to shift the "branch cut" to 180° from the phase you are testing.

Example:  you are using an encoder that "counts" up to 2048 (or 0 .. 2047).  You want to look for a phase close to 0.  If you take the remainder mod 2048, then a phase of 1° will be 6 counts, and -1° will be 2048-6 = 2042 counts, so small numbers will be jumping all over the place.  However, if you first add 1024 to the counts, 6 + 1024 = 1030 = 1030 mod 2048, which is very close to -6 + 1024 = 1018 = 1018 mod 2048.  You've "moved" the discontinuity in the Mod function out of the "area of interest" for your comparison.  Do you get the idea?

Bob Schor

Message 3 of 3
(24 Views)