The SBI instruction only modifies one bit (0-7) at a time. You are trying
to modify a whole byte.
The compiler probably generates a IN, ORI , OUT instruction sequence. One
of the weird things about AVR is that I/O access is bit oriented (since
often you only want to play with one bit of a register) while the register
bit manipulation is byte wide. In fact, there are no CBR/SBR instructions,
they are assembler aliases for ANDI and ORI... I am not sure why Atmel put
those there since they are very confusion when put along side the SBI/CBI
instructions.
You could save one word by doing two SBI's...
Cheers!
-----Original Message-----
From: jay marante
i have this code with ICCAVR:
TCCR1A |= (1<<COM1A1)|(1<<COM1A0);
i wanted to replace that code with this assembly code:
asm("SBI TCCR1A,COM1A1+COM1A0\n");
because i found out that the assembly code that the compiler generate has
three sets of instructions. i think that if i replace the C code with the
corresponding assembly code, i might optimize the flash memory.
but i get this error when i compile it:
"absolute expression expected"
what's wring with my code? did i get it right?
thanks for the help.Message
RE: [AVR-Chat] asm in ICCAVR
2004-06-03 by Larry Barello
Attachments
- No local attachments were found for this message.