Invert pin state of phsa
mikea
Posts: 283
in Propeller 1
Is there a convenient way to have phsa of a counter output low for the determined accumulation instead of high, and otherwise be high. I would like to use the counter with a pnp transistor.
Comments
In which mode ? - you could preload it so the bit.31 starts high, then overflows to 0 ?
You just write to the register, but you will need to update for every pulse, otherwise you just get a constant NCO frequency out.
There is also a %00101 NCO differential mode, that outputs APIN= PHSx[31] & BPIN = !PHSx[31]
APIN > 31 disables mapping, as that's non-existent Port B, so here using BPIN inverts.
NCO mode outputs the MSB of PHSx to the pin. With a negative startvalue the pin goes high. The counter counts up until it goes over zero and then the MSB and therefore the pin goes low.
If you start with a positive value and count down it's the other way around.
Andy
PNP does need a series base resistor, I presume you have ?
How fast is this switching ?