[Top][All Lists]

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

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

Subject: [avr-gcc-list] sbi/cbi instructions from C constructs
Date: Tue, 15 Apr 2003 06:37:06 -0500

The following code snippet only creates executable instructions using
the sbi and cbi instructions when using the in-line assembly listed.  I
seem to remember that in previous versions of avr-gcc, before sfr_defs.h
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 constructs"
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 gcctest8
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

Attachment: makefile.txt
Description: Text document

reply via email to

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