How to connect two 7 segment display to arduino's ports

Hi guys, I'm new using Arduino and right now I'm trying to connect
two 7 segment display to Arduino uno's ports. I'm not allowed to
use digitarRead(), digitalWrite(), pinMode() nor any other auxiliar component
it has to be directly to the arduino's ports (this is a homework).

I was able to connect 1 display to port D using an Common Anode 7 segment
display, it works fine, but I can not do the same for the second display
since portB and portC do not have 7 pines to connect the second the display.

And what I'm trying to show on one of the displays is the next sequence of digits:

and on the other display I need to show the sequence: 20210309

here is my code:

byte digitsD1[9]={B00100100,B01000000,B01111001,B01111000,B01000000,B01000000,B00110000,B00010000,B01000000};

byte digitsD2[8]={B00100100,B01000000,B00100100,B01111001,B01000000,B00110000,B01000000,B00010000};

void setup() {


void loop() {

for(int i=0; i<9; i++){



It works fine for the first display, but I can not figure out a way to show the content of digitsD2 array on the second display.

Any ideas?

Hi @dannloa

Is the same case?

Why post again?

RV mineirin

Yes, it is. Sorry I was just trying to reach more people

You can split the LED between multiple ports, just takes a bit more manipulation in the code.

If you can run low enough current in the display, you could multiplex directly off of a couple of outputs.

I vote for multiplexing. It will be easier, since there are only 2 digits. You'll get extra marks for your work, too!

Are you allowed to use millis() or micros()? Is the hardware fixed, predefined, or can you change it?