Yahoo Groups archive

AVR-Chat

Index last updated: 2026-04-28 22:41 UTC

Thread

asm in ICCAVR

asm in ICCAVR

2004-06-03 by jay marante

i have this code with ICCAVR:

TCCR1A |= (1<
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.

Do you Yahoo!?
Friends. Fun. Try the all-new Yahoo! Messenger

RE: [AVR-Chat] asm in ICCAVR

2004-06-03 by Larry Barello

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!
Show quoted textHide quoted text
-----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.

RE: [AVR-Chat] asm in ICCAVR

2004-06-26 by Dave VanHorn

At 05:18 AM 6/3/2004 -0700, Larry Barello wrote:
>The SBI instruction only modifies one bit (0-7) at a time.  You are trying
>to modify a whole byte.

Very easily confused with SBR and CBR (Which I for one would just like to 
tear out of the assembler), Set BITS in register, and clear BITS in 
register... Just ORI and ANDI instructions re labeled.

Re: asm in ICCAVR

2004-06-30 by Yang Wang

Glad to find this post. It showed me how to embed assembly code in 
the C code. Does anyone know if there is some ICCAVR documentation 
introducing how to embed assembly code in the C code? I cannot find 
in their help documentation at all.

Thanks!

Yang



--- In AVR-Chat@yahoogroups.com, jay marante <jaythesis@y...> wrote:
> 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. 
Show quoted textHide quoted text
> 
> 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.
> 
> 
> 		
> ---------------------------------
> Do you Yahoo!?
> Friends.  Fun. Try the all-new Yahoo! Messenger

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.