Forum: Mikrocontroller und Digitale Elektronik I/O Zugriffe


von Markus (Gast)


Lesenswert?

1
// PORTS
2
#define PORT_com74hc595 PORTC
3
#define PORT_SER     PC0    //74HC595 PIN 14
4
#define PORT_SCK     PC1    //74HC595 PIN 12
5
#define PORT_RCK     PC2    //74HC595 PIN 11
6
7
#define DDR_com74hc595  DDRC
8
#define DDR_SER     DDC0  //74HC595 PIN 14
9
#define DDR_SCK     DDC1  //74HC595 PIN 12
10
#define DDR_RCK     DDC2  //74HC595 PIN 11


Ist das identisch mit Ausnahme das ich Port B anstatt C genommen habe.
1
// PORTS
2
#define PORT_com74hc595 PORTB
3
#define PORT_SER     PINB0    //74HC595 PIN 14
4
#define PORT_SCK     PINB1    //74HC595 PIN 12
5
#define PORT_RCK     PINB2    //74HC595 PIN 11
6
7
#define DDR_com74hc595  DDRB
8
#define DDR_SER     PINB0  //74HC595 PIN 14
9
#define DDR_SCK     PINB1  //74HC595 PIN 12
10
#define DDR_RCK     PINB2  //74HC595 PIN 11

von H.Joachim S. (crazyhorse)


Lesenswert?

nö.

von Timmo H. (masterfx)


Lesenswert?

Und das sieht sogar jemand der absolut keinen Plan von µCs hat dass da 
irgendwas komisch ist.

von M. S. (elpaco)


Lesenswert?

Wie ich eben selbst gelernt habe, vermutlich ja, da unabhängig davon ob 
nun PORTBx, PINBx oder DDBx diese jeweils als x definiert sind. Bspw 
PORTB1 = PINB1 = DDB1 = 1.

Der Übersichtlichkeit halber allerdings wäre der "normale" Weg:
DDRx -> DDxn
PORTx -> Pxn bzw PORTxn (unterschiedlich je nach µC)
PINx -> PINxn

Bitte melde dich an um einen Beitrag zu schreiben. Anmeldung ist kostenlos und dauert nur eine Minute.
Bestehender Account
Schon ein Account bei Google/GoogleMail? Keine Anmeldung erforderlich!
Mit Google-Account einloggen
Noch kein Account? Hier anmelden.