While contemplating the Counter features of the Propeller chip, an interesting idea occurred to me. Since each "Cog" has it's own CTRA and CTRB counters, and given that they run at the system clock (after PLL) speed AND run "in the background" without requiring any particular interaction with running code....
It should be possible to feed in a high(ish) frequency digital signal into an input pin and arrange the CTRA/CTRB features such that the signal is redirected out of an output pin with very little latency and without needing to execute any instructions at all (apart from a small number to set up the features to begin with).
Furthermore, one input pin could supply both CTRA and CTRB simultaneously while two outputs are driven (one for each CTRx).
Even more furthermore, I theorise (but have not yet implemented) that all 16 CTRx features in a Propeller could feed from a single input pin and supply 16 output signals simultaneously!!!
The output signal would be inverted and one master clock cycle behind the input signal. If multiple output signals are generated, then they would all be exactly in phase with eachother (but still inverted and trailing slightly behind the input signal).
"This doesn't sound very useful!" I hear you cry. Well it could be used for the following purposes:
It should be possible to feed in a high(ish) frequency digital signal into an input pin and arrange the CTRA/CTRB features such that the signal is redirected out of an output pin with very little latency and without needing to execute any instructions at all (apart from a small number to set up the features to begin with).
Furthermore, one input pin could supply both CTRA and CTRB simultaneously while two outputs are driven (one for each CTRx).
Even more furthermore, I theorise (but have not yet implemented) that all 16 CTRx features in a Propeller could feed from a single input pin and supply 16 output signals simultaneously!!!
The output signal would be inverted and one master clock cycle behind the input signal. If multiple output signals are generated, then they would all be exactly in phase with eachother (but still inverted and trailing slightly behind the input signal).
"This doesn't sound very useful!" I hear you cry. Well it could be used for the following purposes:
- Re-routing UART data to alternative destinations, or multiple destinations. You'd simply need to re-invert the inverted outputs to get your signal the right side up but this is cheap to do.
- Clock distribution without having to use expensive additional components.
- Simply inverting a digital signal.
- All of the above at up to 80MHz (or more if you like overclocking your Propeller)!
Even if you do have 16 outputs running at a time, you'll still have 12 IO pins (16 minus the pin used for programming the chip and I2C to the EEPROM) free to do other stuff with and you're still not actually running a single instruction of code yet. The only code involved is run once and it only involves setting a couple of registers, but after that your code can forget all about what its counters are up to and get on with other things.