I/O Zugriffe

Gast #3817877
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
#3817893
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

Antwort schreiben

Bitte melde dich an, um einen Beitrag zu schreiben.

oder

Mit Google-Account einloggen

Die Registrierung ist kostenlos und dauert nur eine Minute.

Jetzt registrieren