Hallo
Besser wäre es so:
p[x]=PINA&(1<<x); // für x von 0 bis 7
Die 1 wird x-mal nach links geschoben. Oder noch knapper:
char p, v=0b01010101;
p=PINA;
for (n=0; n<8; n++){
if((v & (1<<n)) == (p & (1<<n)){
Gruß
mic
Hallo
Besser wäre es so:
p[x]=PINA&(1<<x); // für x von 0 bis 7
Die 1 wird x-mal nach links geschoben. Oder noch knapper:
char p, v=0b01010101;
p=PINA;
for (n=0; n<8; n++){
if((v & (1<<n)) == (p & (1<<n)){
Gruß
mic
Bild hier
Atmel’s products are not intended, authorized, or warranted for use
as components in applications intended to support or sustain life!
Lesezeichen