Shop OBEX P1 Docs P2 Docs Learn Events
Countermodules - Can somebody explain the four letter acronyms FRQA and PHSA — Parallax Forums

Countermodules - Can somebody explain the four letter acronyms FRQA and PHSA

StefanL38StefanL38 Posts: 2,292
edited 2010-01-04 10:24 in Propeller 1
Hello,

I'm diving into the countermodules.

Why the heck are the two accessregisters named FRQA and PHSA ?
the acronym FRQ remembers me to "frequency" and PHS to "phase"

But this makes no sense to me. The FRQA-register holds the value that is added to the PHSA-register.
Frequencies added to phase does not make any sense to me.
So can somebody explain what the meaning of these two acronyms are?

best regards

Stefan

Comments

  • TonyWaiteTonyWaite Posts: 219
    edited 2010-01-02 18:45
    Parallax's AN0001 holds the info:
    For each counter A and B within each cog, PHSA or PHSB is the accumulator register;
    FRQA or FRQB is the value to be added when an accumulator condition is true;
    T o n y
  • Tracy AllenTracy Allen Posts: 6,666
    edited 2010-01-02 19:10
    Well, PHSA makes perfect sense as phase. In NCO mode, you have values from 0 to 2^31 with the apin output low, and from 2^31 to 2^32 with the apin output high. It is a fine scale version of 0 to 360 degrees or 0 to 2Pi. If your program needs to add a sudden +90 degree phase shift, then simply add 2^30 to PHSA.

    FRQA is a phase increment that is added (conditionally) to the phase accumulator. Phase advance per unit time is frequency. True it is not directly in units of cycles per second. But with a value of, say, FRQA=536_870, you might think of it as 1/8000 cycle per 12.5 nanoseconds. Higher values of FRQA give higher frequency, a higher rate of accumulation of phase. It is twos complement--Negative values of FRQA move the accumulator backwards.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Tracy Allen
    www.emesystems.com
  • jazzedjazzed Posts: 11,803
    edited 2010-01-02 19:14
    StefanL38 said...
    ...Why the heck are the two accessregisters named FRQA and PHSA ?
    the acronym FRQ remembers me to "frequency" and PHS to "phase"

    But this makes no sense to me. ...
    In NCO mode at least, FRQx defines the rate that PHSx is updated. You can set when the NCO result is output on a pin by setting PHSx to a value. A 2 bit counter can be set up on say pins P8/P9 with counter A/B with FRQx set $2000_0000 and $1000_0000 for example with CTRx set to $100 << 26. When you want to reset the "phase" of the counter you write values to PHSx. I most often do this as part of quickly grabbing long data out of externally attached memory.
  • StefanL38StefanL38 Posts: 2,292
    edited 2010-01-02 20:21
    Aha - OK it's some kind of phase.

    A phase can only be defined to a zero-relation. (As every angle needs to lines to be defined. A starting line and a endline.
    So where is the "zero-line" in this case?

    I know phases from AC-circuits which include capacitors and inductives for a chosen set of values for R, C, and L you get a certain phase between current and voltage.
    Coming from that picture it is hard for me to understand what it means exactly in this case.

    I would call the PHSx the SR-register (Summarized Result). And the FRQx the VTA-register (Value To Add)

    So a short description of the function would be:

    Every clockcycle the value of the VTA-register is added to the SR-register. The value of the MSB (=Bit31) of the SR-register is copied to the IO-Pin specified in the Output-A-register (APIN)

    If the SR-Register starts with a value greater than zero. The rollover from max-value to zero happens earlier. This has the effect of a positive phase-shifting.
    The register still counts up from 0 to $FFFF_FFFF but the set and clear be of the MSB will be in front of a counter that starts at zero. (= with a positive phase)

    So as we are in the binary world - does phase mean in this case value 0 or value 1 (as the specified Output-pin can only be 0 or 1) ?

    If multiple counters start at the same time but start with different values in the SR-Register this results in a phase-shifted set and clear of the MSB of the SR-registers.
    Depending on the start-value this phase-shift is bigger or smaller.

    But accumulating phases like a phase of 10 degrees added to a phase of 25 degrees is NOT what is happening and for this my opinion is the name phase-accumulator is badly chosen.
    Of course the value in the VTA-register determines the frequency with wich the MSB of the SR-register is set to 1 and cleared to 0.

    best regards

    Stefan
  • jazzedjazzed Posts: 11,803
    edited 2010-01-02 21:13
    Seems like you got the spirit of it. The moon has what is traditionally called phases, but it doesn't have registers .... [noparse]:)[/noparse] Terms are often borrowed. No big deal.

    A 2 bit binary counter has 4 "phases" ... you can choose the starting phase at any time with limits. A pulse (another mode for counters) also has a phase, but that's another story.
  • AribaAriba Posts: 2,690
    edited 2010-01-02 23:14
    Sorry, I write this in german, because I don't know all the english terms....

    Stefan

    Ich nehme an du kennst den Zusammenhang von Sinussignal und Kreisbewegung. Der Sinus ist die Y-Differenz zur Nulllinie aufgezeichnet f
  • StefanL38StefanL38 Posts: 2,292
    edited 2010-01-03 09:21
    Thank you very much for the explanation Ariba !
    Now I got the right picture.

    best regards

    Stefan
  • w8anw8an Posts: 176
    edited 2010-01-03 17:57
    www.systranet.com/ TRANSLATION
    =================================

    CH takes on you knows the connection of sine signal and circulation. The sine is noted the Y-difference to the zero-line for a full revolution. Therefore one divides one period of a sinus oscillation in 360°.
    The phase angle runs thus from 0..360° and begins again with 0. Now one uses in addition, for all other periodic oscillations, not only sine. Two square waves extinguish themselves are e.g. 180° out of phase.

    A propeller Counter is nothing else as an oscillator. The PHSx register runs from 0 to the maximum and begins again with 0 etc. corresponds exactly to the process of the phase angle with the sine. One a sine table continuously would come out a sine, one became the PHSx register notes gets one a saw tooth, and takes one only the highest bit, like with the propeller Counter receives one a rectangle (0..179°=Low, 180..359°=High).

    Whether FRQx is the correct designation, about it one can argue. PHASE_STEP or like that it would be perhaps more accurate but the trick of this principle is exact that the frequency of the rectangle (or saw tooth, sine) is directly proportional to the value of this register, therefore is the designation already OK ONE. The whole calls itself by the way DirectDigitalSynthese DDS, just thereafter googles.
    That is naturally stimmig only if the Counter in the NCO mode is operated. But one cannot rename the registers well for each mode of operation. And the other modes of operation are actually only sophistiated modifications of the DDS of principle, with which increase that the phase register one makes dependant on logic functions.
  • SamMishalSamMishal Posts: 468
    edited 2010-01-04 01:59
    w8an said...
    www.systranet.com/ TRANSLATION
    =================================
    I don't know enough German but I am sure the original·text was no where near as atrocious as the translated English.....devil.gif

    Those computerized translators are just not up to the job in most cases.....ok...they do a reasonable job with
    small simple paragraphs....and...they do help in giving one a modicum of a hint of an inkling·of what the gist
    of the text is ....tongue.gif ...but....beyond that they are really not suitable for a REAL translation.

    I guess Douglass Adam's Babble Fish is·still needed.....

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Samuel

    www.RobotBASIC.com
    ·
  • Graham StablerGraham Stabler Posts: 2,510
    edited 2010-01-04 10:24
    I'm too late really but the way I was taught to think about phase was to consider it as the argument of a sine wave (or any periodic function)

    sin(phase)
    
    



    Phase may vary with time and/or distance depending on the case (travelling waves vary in both, electrical signals in time and spatial waves (like some lines drawn on paper) in space only). Phase would normally be measured in radians.

    Frequency is essentially the rate of change of phase with time, that would be omega (rad/s) in scientific circles where w=2pi.f (because there are 2pi radians in a cycle).

    Of course this is not a sine and it does not use radians but the ideas are just the same, PHSA is the current argument to the function (which is just an overflow) and FRQA affects the rate of change of that argument. Normally it does so with time but using the conditional modes could do so for any quantity if you can produce the right signal to drive it.

    Graham
Sign In or Register to comment.