avr-gcc-list
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [avr-gcc-list] Assembler error message


From: Denis Chertykov
Subject: Re: [avr-gcc-list] Assembler error message
Date: 18 Mar 2001 21:11:47 +0300

Jens Andersen <address@hidden> writes:

> Hi Robert,
> 
> I think that your problems come from the fact that the CBR instruction
> requires
> a register as the target, and as you want to modify a variable, this
> wont work.
> 
> I assume that what you want to do, is to clear one or more bits in a
> variable,
> using a bit mask, so maybe you could try this.
> 
> //IR_Status variable
> #define IR_Avail 128
> 
> volatile unsigned char IR_Status = 0x20;
> 
> #define CLEARBIT_CONST(var, mask) (var &= ~mask)
> 
> void main(void)
> {
>   CLEARBIT_CONST(IR_Status, IR_Avail);
> }
> 
> Compiled with option -O2 this generates the following assembler code.
> 
>   10:test.c        ****   CLEARBIT_CONST(IR_Status, IR_Avail);
>   56                          .stabn 68,0,10,.LM2-main
>   57                  .LM2:
>   58 0008 8091 0000           lds r24,IR_Status
>   59 000c 8F77                andi r24,lo8(127)
>   60 000e 8093 0000           sts IR_Status,r24
>   11:test.c        **** }
> 
> I think that this is as best as you can get it. :)

I'm agree with this.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]