dran nicht, aber drin! und das bestätigt der high-pegel.
siehe
http://www.mikrocontroller.net/articles/AVR-GCC-Tutorial#Ausg.C3.A4nge
:
Falls der Anfangszustand von Ausgängen kritisch ist, muss die
Reihenfolge beachtet werden, mit der die Datenrichtung (DDRx)
eingestellt und der Ausgabewert (PORTx) gesetzt wird. Für Ausgangspins,
die mit Angangswert "high" initialisiert werden, zuerst die Bits im
PORTx-Register setzen und anschliessend die Datenrichtung auf Ausgang
stellen. Daraus ergibt sich die Abfolge Eingang -> setze PORTx:
interner Pull-Up aktiv -> setze DDRx: Ausgang "high". Bei der
Reihenfolge erst DDRx and PORTx, kann es zu einem kurzen "low-Puls"
kommen, der auch exterene Pull-Up-Widerstände "überstimmt". Die
(ungünstige) Abfolge: Eingang -> setze DDRx: Ausgang (auf "low", da
PORTx nach Reset 0) -> setze PORTx: Ausgang auf high. Vergleiche dazu
auch das Datenblatt Abschnitt Configuring the Pin.
da steht nämlich auch nichts von einer reihenfolge:
The DDxn bit in the DDRx Register selects the direction of this pin. If
DDxn is written
logic one, Pxn is configured as an output pin. If DDxn is written logic
zero, Pxn is config-
ured as an input pin.
If PORTxn is written logic one when the pin is configured as an input
pin, the pull-up
resistor is activated. To switch the pull-up resistor off, PORTxn has
to be written logic
zero or the pin has to be configured as an output pin. The port pins
are tri-stated when
reset condition becomes active, even if no clocks are running.
If PORTxn is written logic one when the pin is configured as an output
pin, the port pin is
driven high (one). If PORTxn is written logic zero when the pin is
configured as an out-
put pin, the port pin is driven low (zero).
ich dachte, das wäre ein alter hut!?