can somebody explain the acronyms FRQx and PHSx ?
StefanL38
Posts: 2,292
Hi,
I'm back on learning more details about the counters.
I know the function of FQRx and PHSx. But what does the acronyms stand for?
Is FQRx the short name for FR)eQ)ency?
What is the long name of PHS?
It's surely not P)auls H)ot S)ausage
But what does it stand for?? Maybe it makes sense. But in the docs I've read everywhere was just
the acronym.
The prop is five years old now. So its much to late to change the acronyms.
But usually acronyms make sense like JMP for jump SHR for SH)ift bits R)ight etc.
So whats the meaning of the TLA (three letter acronym) FQR and PHS?
best regards
Stefan
I'm back on learning more details about the counters.
I know the function of FQRx and PHSx. But what does the acronyms stand for?
Is FQRx the short name for FR)eQ)ency?
What is the long name of PHS?
It's surely not P)auls H)ot S)ausage
But what does it stand for?? Maybe it makes sense. But in the docs I've read everywhere was just
the acronym.
The prop is five years old now. So its much to late to change the acronyms.
But usually acronyms make sense like JMP for jump SHR for SH)ift bits R)ight etc.
So whats the meaning of the TLA (three letter acronym) FQR and PHS?
best regards
Stefan
Comments
so to me these acronyms don't make much sense.
I'm sure somehow the FRQ-registers determine frequencies and somehow PHS determines a "Phase".
But what it directly does is the FRQ-registers contains a summand
The PHS-register contains the actual accumulated sum which summarised by adding value of FRQ to PHS.
It won't change names in the docs - but anyway - I want to make a suggestion for better names:
increment-summand for FRQ and a short name could be Inc-Sx
total-sum for PHS and a shortname could be TSUMx
Now please write arguments against these new names and explain why the old names describe things better.
I hope this discussion will make it more understandable why the names FRQ and PHS are chosen
best regards
Stefan
And phsx really is a phase in this context, since its contents specify the counter's state at any particular time.
-Phil
What happens, if you increase FRQ?
The sum will overflow faster! And as the MSB or the overflow (depending on the setup of the counter) will drive the output, in fact the frequency increases. So, the frequency of the output is proportional to the value in FRQ.
What happens, if you change PHS?
Let's say we set a trigger pin to 0 and then set PHS to 0 (keeping the FRQ constant). FRQ determines how long it takes until the counter output changes to 1.
Now we set the trigger pin to 1 and then set the PHS to a value bigger than 0. What happens to the counter output? It's changing earlier than before. So, what did we change by putting a higher start-value into PHS? Right ... the phase.
So, for me the current naming makes perfect sense.
The rate it moves around the circle is set by the FRQx. It is like expressing frequency as radians per second or degrees per second. In simple NCO or DUTY modes, the FRQx value is added once per clock cycle, e.g. 80 million times per second. If you divide the number of counts in a circle by the FRQx value, is how many iterations it takes for dial to make one complete cycle. For example if FRQx = 50000 then 50000 has to be added to itself 85899 times to get all the way through the phase accumulator. Then there is the time it takes. At 80MHz, the addition is done once every 12.5 nanoseconds, and is 85899 * 12.5 ns = 0.0010737375 second. That is the period and corresponds to a frequency of 931 Hz. The output pin will go low and high at close to 931 Hz. (I say close to, not exactly, because there are some remainders from the division).
Given a desired frequency Fx in Hz for complete cycles, calculate the required incremental frequency FRQx thus
FRQx = Fx * 4294967296 / clkfreq
If you want to preset the phase PHSx to some value expressed in degrees, then
PHSx = degrees * 4294967296 / 360
Someone you maybe know, has asked this more than a year ago, and my explication was very similar to Tracy Allens:
http://forums.parallax.com/showthread.php?118836
Andy
please can you explain who is StefanL38 to me ?
I forgot that completely. I wouldn't have asked if I would have remembered it.
Is this beginning Alzheimer? Hope not.
Thank you anyway for re-programming my memory. Got to repeat it 10-20 times now to get into the longterm memory.
best regards
Stefan
Don't feel bad. I've done that more than once myself. The best part of having an imperfect memory is the constant exhilaration of new discoveries!
-Phil