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

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

Re: [avr-gcc-list] Newbie - should this work?


From: Volkmar Dierkes
Subject: Re: [avr-gcc-list] Newbie - should this work?
Date: Mon, 20 Jan 2003 07:02:55 +0100
User-agent: 40tude_Dialog/2.0.3.1 Hamster/2.0.0.0

Christoph,

On Mon, 20 Jan 2003 00:24:04 +0100, Christoph Plattner wrote:

> sorry, but I cannot understad this !
> How should this work. As I saw in the library (ok, it is some months 
> old), the PORTD is define to 0x12 (example of a 8515).
>
> What shall the compler do, if you write
>
>               PORTD = 0x00;
>
> which means
>
>               0x12 = 0x00;
>
> What code shall there be generated ??

Here is an example:
  32:Akkulad.c     ****   // Port C = Analog-Ins
  33:Akkulad.c     ****   DDRC  = 0;
  95                            .stabn 68,0,33,.LM4-Init_Ports
  96                    .LM4:
  97 0006 14BA                  out 52-0x20,__zero_reg__

> So this is the reason, why I cannot understand, that this code
> works. Or is the io.h completely written in another way.
> I cannot see a way per include files to get a
>
>               PORTD = 0x00;
>
> to a
>
>               outp (0x00, 0x12);

As you can see in the example, the code is correct. But it seems you 
have an older version. In the newest version, and as I remember 
since 3.2, the ports are defined as:
/* Data Register, Port D */
#define PORTD   _SFR_IO8(0x12)

You see the _SFR_IO8()? The using of this causes the compiler to use 
it as an access to the IO area.

HTH

Volkmar
avr-gcc-list at http://avr1.org



reply via email to

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