copy or fill a range of cogram
ManAtWork
Posts: 2,176
in Propeller 2
I need a buffer for ADC samples of multiple pins. Then I have to do some complex calculations on them. Because the calculations take some time and I don't want the samples to be overwritten before I'm done I have to use double buffering. New samples are added into the buffer values for averaging. So I have to clear the buffer before it's re-used.
Is there a trick to copy a range of cogram registers to another range or to fill multiple registers with zeroes? At the moment I'm using setq+wrlong/rdlong to/from an intermediate buffer in hub ram. This takes about the same time as a loop with ALTS/D indexing but is much simpler.
Is there a more elegant way, maybe with the streamer? Or a more clever way of indexing?
Is there a trick to copy a range of cogram registers to another range or to fill multiple registers with zeroes? At the moment I'm using setq+wrlong/rdlong to/from an intermediate buffer in hub ram. This takes about the same time as a loop with ALTS/D indexing but is much simpler.
Is there a more elegant way, maybe with the streamer? Or a more clever way of indexing?
Comments
BTW, your ADC and DAC tutorials were really informative. And using the P2 as scope to visualize or debug it's own output is really brilliant.
Yes! That would work.
I'm adding it to the tricks and traps thread.