- Tue Oct 26, 2010 4:34 pm
#112184
This may be a little old, but I figure I'll add to it anyways.
As stevech has pointed out, by using the LDI instructions you are trading off program space for execution time.
dumais wrote:Since the constant I am passing is part of the instruction (ldi r24,101 is one full instruction) it will never even go in ram, it will be loaded in the r24 register directly. Avoiding a memory transfer. The only "memory transfer" is the one the the instruction register needed to be loaded but that is insignificant because we would need it anyway if we were to do it any other way. When I do "std Y+2,r24" there is also a memory transfer from register to RAM that I would have to do any way.AVR does not have a SRAM->SRAM instruction. Everything has to go through registers.
As stevech has pointed out, by using the LDI instructions you are trading off program space for execution time.