I'm using an Atmega328P micro controller and need a time wasting loop in assembly. I want to be able to waste time for 500ms (or any desired time) but can't find a reasonable way to do so.
I have tried something like:
TimeWastingLoop:
CPI R19, 0xFF ; compare register with immediate
JMP MAIN
NOP NOP NOP ; Do nothing...
INC R19 ; increment r19 (started @ 0x00)
JMP TimeWastingLoop
I will end up putting A LOT of NOP
s so I'm thinking there must be a better way.... Any ideas