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

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

Re: [avr-gcc-list] AVR GCC compiler for win98


From: Valéry Florimond \(Thought Technology Ltd\)
Subject: Re: [avr-gcc-list] AVR GCC compiler for win98
Date: Thu, 18 Apr 2002 17:11:40 -0400

Hi,
 
First, PORTD, DDRD and PIND are numbers, the macros are defined in iomXXX.h (were XXX is the microcontroller you are using).
for ex: #define PORTD     0x12
 
so your code should be:
*((BYTE*)sw4_dir) &= ~sw4_pin;//set port as input
 
Secondly, there are I/O addresses. If you want a SRAM access, add the memory offset (for atmega103, add 0x20 for example);
 
 
Val.

 
----- Original Message -----
From: Rob Ward
Sent: Thursday, April 18, 2002 4:19 PM
Subject: Re: [avr-gcc-list] AVR GCC compiler for win98

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).

TIA.

Rob Ward
avr-gcc-list at http://avr1.org

reply via email to

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