Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Anchor_Ref126982199_Ref126982199 Anchor_Toc132701956_Toc132701956 Anchor_Toc132702655_Toc132702655Register: Counter A and Counter B Phase Registers.

((PUBPRI))
   PHSA

...

((PUBPRI))
   PHSB

...

Returns: Current value of Counter A or Counter B Phase Register, if used as a source variable.

...

Explanation

PHSA and PHSB are two of six registers (CTRA, CTRB, FRQA, FRQB, PHSA, and PHSB) that affect the behavior of a cog's Counter Modules. Each cog has two identical counter modules (A and B) that can perform many repetitive tasks. The PHSA and PHSB registers contain values that can be directly read or written by the cog, but may also be accumulating with the value of FRQA and FRQB, respectively, on potentially every System Clock cycle. See CTRA on page for more information.

...

...

Using PHSA and PHSB

PHSA and PHSB can be read/written like other registers or pre-defined variables. For example:

Code Block
PHSA := $1FFFFFFF 

The above code sets PHSA to $1FFFFFFF. Depending on the CTRMODE field of the CTRA register, this value may remain the same, or may automatically increment by the value in FRQA at a frequency determined by the System Clock and the primary and/or secondary I/O pins. See CTRA, CTRB on page for more information.

Note that in Propeller Assembly, the PHSA and PHSB registers cannot be used in a read-modify-write operation in the destination field of an instruction. Instead, separate read, modify, and write operations (instructions) must be performed.

Keep in mind that writing to PHSA or PHSB directly overrides both the current accumulated value and any potential accumulation scheduled for the same moment the write is performed.