@OP
david_2018:
Is it safe to run the common connection to an I/O pin? The current will be the sum of all the LED segment currents.
Paul__B:
And that is indeed the concern. So note in that diagram, the resistors are 2k2, not 220 Ohms, limiting the total current to less than 20 mA.
Assume that all the 8 segments are ON. Total currents to be drawn by a digit is: (5-2/2.2K)*8 ~= 11 mA which is less than the sink current (20 mA) of an IO pin of the UNO. The design looks OK; but, it is at the cost of a comfortable brightness. The cc-pin has been directly connected with an IO pin in order to avoid the use of an addition power buffer.
And this of course, requires multiplexing code, which is a challenge in itself.
Sample Example for OP
(1) Declare the following Lookup Table (LUT) to obtain cc-code for a digit (0 - 9, A - F)
byte lupTable[16] =
{
0x3F, 0x06, 0x5B, 0x4F,0x66, 0x6D, 0x7D, 0x07,
0x7F, 0x6F, 0x77, 0x7C, 0x39, 0x5E, 0x79, 0x71
}; //cc--code VS digit: 0 -----9, A ------ F
(2) Add two hex numbers:
byte x = 0x21 + 0x39 = 0x5A;
(3) Show 5 at DP0-position
[b](a)[/b] extract 05 from 5A
byte y = x;
y = y >> 4; //y = 05
(b) Use y as index to collect cc-code of 5 from LUT
byte z = lupTable[y]; // z = 6D the cc-code of 5
(c) Send the value of z to DP0 via PORTD
PORTD = z;
(d) Assert LL at cc0-pin and LH at cc1-pin
digitalWrite(8, LOW);
digitalWrite(9, HIGH);
(4) Follow Step-3 and show A on DP1-position of display.
(5) Now build the codes of Step-3 and Step-4 together so that 5A appears simultaneously on the display unit.