I have an ATtiny 85 and i wrote this:
.set D3 = 0x08 ldi r16, 0x05 ldi r17, 0x01 rcall delay rjmp PC delay: sbiw r17:r16, 1 brcc delay ret
and i get an error on SBIW, "Invalid register", any idea how to fix this?
I have an ATtiny 85 and i wrote this:
.set D3 = 0x08 ldi r16, 0x05 ldi r17, 0x01 rcall delay rjmp PC delay: sbiw r17:r16, 1 brcc delay ret
and i get an error on SBIW, "Invalid register", any idea how to fix this?
SBIW - Subtract Immediate from Word
Description:
Subtracts an immediate value (0-63) from a register pair and places the result in the register pair. This instruction operates on the upper four register pairs, and is well suited for operations on the pointer registers.
As you can see from the instruction description, the register pair you want to use is out of range for this instruction.
edit: so to answer your question, you need:
delay: subi r16, 1 sbci r17, 0 brcc delay ret
Thanks, i fixed it with sbiw r25:r24, 1