[En-Nut-Discussion] I/O pins control

Cosmin Buhu lists at byteworks.ro
Tue Nov 9 15:02:40 CET 2004


----- Original Message -----
From: "Martin Paces" <marpac at centrum.cz>
To: <en-nut-discussion at egnite.de>
Sent: Tuesday, November 09, 2004 3:49 PM
Subject: [En-Nut-Discussion] I/O pins control


> Hi guys,
>
> I'm just starting with the Ethernut project. I already bought the Charon
II DB packet and have done some stuff. But I can't find any document
containing the stuff about I/O pins control. I tried to check the examples
and the .h files and there is so many things to understand.
> Could you help me to learn the I/O pins control?
>
> I found the outp() and inp() functions, cbi() and sbi() as well.
>
> 1) cbi() and sbi() works fine, outp() too, I don't know how to handle
inp().

    All these are deprecated, but reading port E value:
unsigned char pval;
pval = inb( PINE );
    Do not fall in the common trap to read from PORTE instead;

> 2) How to check, if there is an input bit set to 1 or 0?

    See bit_is_set/bit_is_clear or some binary maths.
    These questions are described in the "Special function register" chapter
of avr-libc documentation.

> 3) What are the differences between the port deffinitions DDRD, DDD3 for
instance, PORTD, PORTD3 and so on?

    Well, you should really read the datasheet of your engine, ATMega128.

>
>
> Thanks a lot for your help for the newbee :-)))


Regards,
Cosmin




More information about the En-Nut-Discussion mailing list