Jay,
Sorry, you can't do that in a single instruction, you do indeed need
three as TCCR1A is at an I/O location that is not reachable by SBI and
CBI instructions (only I/O addresses 0-31 are). Not only that, SBI and
CBI take bit numbers not masks and cannot set or clear multiple bits.
Hence, the code the C compiler generates is the most compact you can
get: three instructions to set a single bit.
So to answer your final question: no, you didn't get it right. ;-)
--
Paul Curtis, Rowley Associates Ltd http://www.rowley.co.uk
<http://www.rowley.co.uk/>
CrossWorks for MSP430, ARM, and (soon) Atmel AVR processors
-----Original Message-----
From: jay marante [mailto:jaythesis@yahoo.com]
Sent: 03 June 2004 13:05
To: AVR-chat@yahoogroups.com
Subject: [AVR-Chat] asm in ICCAVR
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 Paul Curtis
Attachments
- No local attachments were found for this message.