Using D0-D13 as a bus.

Hello.
I want to make quite a simple thing.
I have a 7 segments + dp display from a microwave I want to connect to a Nano Pro Mini to display numbers.
For the tests I use a Uno, no matters.
Usual display, ABCD...G + dp on anode, grounds on cathode.

I can of course command each segment individually. Example for 1 :
void affiche_1 (int afficheur) {

  • for (i=2; i<=9; i++ ) {*
  • digitalWrite(i, LOW);*
  • }*
  • digitalWrite(Aff_1, LOW);*
  • digitalWrite(B, HIGH);*
  • digitalWrite(C, HIGH);*
  • digitalWrite(Aff_1, HIGH);*
    }

Instead of adressing each individual digital output, I suppose there's a way to treat D2-D9, or D0-D9, as a bus , and write in this bus in hexa.
How do we use D0-D13 as a bus, instead of single bits ?
Thanks.
Phil.

PORTD = 0xFF;
write all 1s to D7 to D0

PORTB = 0xFF;
write all 1s to D13 to D8

Fill in FF with your number.

PORTD = 0xFF;

PORTB = 0xFF;

Note that this only works on boards based on the ATmega328p (Uno, Nano)
Other boards have much more scattered bits/ports.