[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [avr-gcc-list] AVR GCC compiler for win98
From: |
Larry Barello |
Subject: |
Re: [avr-gcc-list] AVR GCC compiler for win98 |
Date: |
Thu, 18 Apr 2002 14:18:45 -0700 |
GCC doesn't know how to access I/O directly. You have to do the
following (i may have the order backwards - check iomacros.h)
outb(sw4_dir, inp(sw4_dir) & ~sw4_pin);
outb(sw4_port, inp(sw4_port | sw4_pin);
The sbi and cbi assembly instructions (which the macros reduce to) are
only one cycle each. Much faster than in-modify-out that you were
proposing.
----- Original Message -----
From: "Rob Ward" <address@hidden>
> Hi. I am using GCC under w2k. I tried using this code from
avrfreaks...
>
> #define sw4_pin (1<<4) //this could be (1<<PD4)
> #define sw4_port PORTD
> #define sw4_dir DDRD
> #define sw4_in PIND
>
> Then the following to toggle the pin / i/o direction...
>
> sw4_dir &= ~sw4_pin;//set port as input
> sw4_port |= sw4_pin; //switch on pull up
>
> however, I get "Invalid lvalue in assignment" for both the last two
lines when compiling. Could anyone tell my why this is?
>
> I don't want to use the __sbi and __cli macros as they take two
clock cycles to execute, whereas and'ing and or'ing the registers
directly only takes one clock cycle (as far as I understand it).
avr-gcc-list at http://avr1.org
- [avr-gcc-list] AVR GCC compiler for win98, sreelakshmi, 2002/04/28
- Re: [avr-gcc-list] AVR GCC compiler for win98, Peter Bosscha, 2002/04/28
- Re: [avr-gcc-list] AVR GCC compiler for win98, Paulo Abreu, 2002/04/28
- Re: [avr-gcc-list] AVR GCC compiler for win98, Nils Kristian Strom, 2002/04/28
- Re: [avr-gcc-list] AVR GCC compiler for win98, Rob Ward, 2002/04/28
- Re: [avr-gcc-list] AVR GCC compiler for win98, Valéry Florimond \(Thought Technology Ltd\), 2002/04/28
- Re: [avr-gcc-list] AVR GCC compiler for win98,
Larry Barello <=
- Re: [avr-gcc-list] AVR GCC compiler for win98, Nils Kristian Strom, 2002/04/28
- Re: [avr-gcc-list] AVR GCC compiler for win98, Rob Ward, 2002/04/28
- Re[2]: [avr-gcc-list] AVR GCC compiler for win98, Andreas Schwarz, 2002/04/28
- Re: [avr-gcc-list] AVR GCC compiler for win98, Rob Ward, 2002/04/28
- RE: [avr-gcc-list] AVR GCC compiler for win98, PE, 2002/04/28
- RE: [avr-gcc-list] AVR GCC compiler for win98, Sander Pool, 2002/04/28
- RE: [avr-gcc-list] AVR GCC compiler for win98, Panther Electronics, 2002/04/28
- RE: [avr-gcc-list] AVR GCC compiler for win98, Marc R. Wetzel, 2002/04/28
- Re: [avr-gcc-list] AVR GCC compiler for win98, webmaster, 2002/04/28
- Re: [avr-gcc-list] AVR GCC compiler for win98, Marc Wetzel, 2002/04/28