Ross Myers

Memory move, saving CPU cycles

Discussion created by Ross Myers on Dec 9, 2007
Latest reply on Dec 9, 2007 by bigmac
Hi All,
 
Just looking a the crude method I've used to transfer a message from a CAN Rx buffer into a RAM buffer.
Something like this below uses over 90 cycles....
 
        lda   MSCANRXBUF
        sta   CANRxBuffer             
        lda   MSCANRXBUF+1
        sta   CANRxBuffer+1
        lda   MSCANRXBUF+2
        sta   CANRxBuffer+2       
        ...
        ...
        lda   MSCANRXBUF+12
        sta   CANRxBuffer+12
 
Now I guess I could set up memory pointers and increment them in a loop, but, in the end am I actually going to save any CPU cycles looping around to still use the same commands anyway?
I don't have any efficient loop routines, but maybe someone has an example on how much more efficient a memory transfer loop might be when only dealing with a relatively small memory transfer.
 
Thanks,
Ross

Outcomes