[Top][All Lists]

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

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

From: Christoph Plattner
Subject: Re: [avr-gcc-list] Newbie - should this work?
Date: Mon, 20 Jan 2003 00:24:04 +0100
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.0.1) Gecko/20020830


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 ??

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



Volkmar Dierkes wrote:

On Sun, 19 Jan 2003 18:36:25 +0100, Christoph Plattner wrote:

In principal, I don't think your code is correct !

All the other answers have not dealt with that, why ???

PORTD and DDRD are defines to registers numbers.

I think you have to use inp() and outp() or do a memory
access with `* (unsigned char *) <addr> = xxx'

example (which works):

    outp(0xff, DDRB);
    outp(0x00, PORTB);

Since AFAIK 3.2 is the recommend access to I/O ports via direct access as Josh has used it. That isn't the problem.

Memory access wouldn't work because they are in the io area, not in memory.

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

private:        address@hidden
company:        address@hidden

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

reply via email to

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