bits and pins

I'm trying to make something like this: http://www.instructables.com/id/Yet-Another-Daft-Punk-Coffee-TableDisplay/ What i do not understand is how are byte values related to arduino pins. This guy is using 8 bits, but how are they mapped to pinout ports?

He is using direct port access, using PORTB, you can read a bit more about direct port access here: http://hekilledmywire.wordpress.com/2011/02/23/direct-port-manipulation-using-the-digital-ports-tutorial-part-3/

Thank you, that helped. Now i'm clear what does PORTD do. However, PORTB remains mistery :)

So i have two more questions. What does pins 6 & 7 do with PORTD? What does PORTB = B00100000 activates? 13?

As i see it port map would look like this |PORTD | PORTB | |0 1 2 3 4 5 6 7| 8 9 10 11 12 13 __ __|

What does PORTB = B00100000 activates? 13?

Yes, but

PORTB |= (1<<PINB5);
or
PORTB |= B00100000;

is usually better because it doesn’t clear the other pins.

EDIT. Sorry typo, should have been |=


Rob

Yes, but

PORTB != (1<<5);
or

Better still:

PORTB |= (1<<5);

Use

PORTB &= ~(1<<5);

to clear it.

I'm little bit confused now...I'm reading this: http://arduino.cc/en/Reference/BitwiseAnd It says: "So if we write PORTD = B00110001; we have made pins 2,3 & 7 HIGH. "

Arent' 0,4,5 HIGH?

Yes, that is wrong - maybe it was referring to an earlier processor's pins, and not Arduino pins.

Ok. Everything is much clearer now.