[Top][All Lists]

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

Re: [avr-gcc-list] sbi/cbi instructions from C constructs

Subject: Re: [avr-gcc-list] sbi/cbi instructions from C constructs
Date: Tue, 15 Apr 2003 07:34:42 -0500

Interesting to reply to your own posting......

However, I've discovered my "problem".  I had the optimization level
set to -O0.  Changing it to -O1 and 
ta da!  sbi and cbi instructions :)

>>> "TODD BATZLER" <address@hidden> 04/15/03 06:37AM >>>
The following code snippet only creates executable instructions using
the sbi and cbi instructions when using the in-line assembly listed. 
seem to remember that in previous versions of avr-gcc, before
was included in all ioxxxx.h files and iomacros.h was eliminated, that
it was possible to use the sbi and cbi macros to generate these
instructions. (Of course I've a great memory, it's just short :) ) 
Without the asm() lines, all the port modifcations are
read/modify/write.  Does anyone have a method to generate "C
so that I can use statements like PORTB7 = 1?

I've attached my makefile if someone wants to quickly compile and look
at the lss file.  My apologize in advance to Volker and Weddington for
"standing on their shoulders" to create both this function from
and the makefile.

#include <avr/io.h>
int main(void)

    asm volatile("cbi 0x18, 0x07");
    PORTB |= 0x80;
    asm volatile("sbi 0x18, 0x07");
    for (;;) 

Todd Batzler
Senior Staff Engineer
Miller Electric Mfg Co
1635 W Spencer St
Appleton, WI 54914-0000 USA
920 735 4230
Phone:  920 735 4230
Fax:  920 735-4488
email:  address@hidden

reply via email to

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