Reading and writing PHSA in NCO mode
K2
Posts: 693
in Propeller 1
Have a situation where I need to create phase discontinuities in the output of CTRA while the counter is running in NCO mode. This suggests I would need to do some sort of Read-Modify-Write to PHSA. A warning in the manual goes something like this: "Beware that doing a read-modify-write instruction on PHS, like "ADD PHSA, #1", will cause the last-written value to be used as the destination operand input, rather than the current accumulation."
My brain is too scrambled ATM to decipher that sentence, but it doesn't sound good... Doesn't sound like the right way to accomplish phase modulation.
What _is_ the right way to step PHSA with some regularity?
My brain is too scrambled ATM to decipher that sentence, but it doesn't sound good... Doesn't sound like the right way to accomplish phase modulation.
What _is_ the right way to step PHSA with some regularity?
Comments
-Phil
Kool. Maybe that accounting can be determined empirically by arranging for one read/add/write sequence for each cycle of the counter, to be done immediately after each negative excursion of the counter output. The addition would add zero. You could then measure the new frequency, invert the result, and subtract the old period.
(The synchronized one-update-per-cycle is to avoid the situation where the MSB in PHSA changes while you're doing the read, null addition, and write.)