I did't find exactly the same code that you are using on the site you referred to (Arduino 4 Digit 7 Segment Display Tutorial) so I assume that your starting code is a hybrid out of bits that have been put together from different sources.
Anyway, the problem is clear. Look at the following which is a mapping between ports and arduino pin numbers
You'll see that PORTD maps to arduino pins D0 through to D7. Segment G of your display is connected to pin D8 which is outside this range.
If you want to use your existing program structure, you'll have to do something like the following:
in setup(), add the following line at the end:
pinMode(8,OUTPUT);
digitalWrite(8,HIGH);
Make changes to your inner loop structure
for(int k=0; k< 100; k++)
{
// Turn ON Display 1 using the control Pin
digitalWrite(10,HIGH);
// Turn OFF Display 2 using the control Pin
digitalWrite(11,LOW);
// Write the set of values for the digit '2' to the PORT register
// PORTD = seven_seg_val; ?????
PORTD = seven_seg_val[i];
if ( i != 0 && i != 1 && i != 7 ) {
digitalWrite( 8 , LOW ) ; // sement G ON
}
else {
digitalWrite( 8 , HIGH ) ; // sement G OFF
}
// A Short Delay
delay(1);
// Reset the PORT Register to 0
PORTD = 0;
// Turn OFF Display 1 using the control Pin
digitalWrite(10,LOW);
// Turn ON Display 2 using the control Pin
digitalWrite(11,HIGH);
// Write the set of values for the digit '3' to the PORT register
PORTD = seven_seg_val[j];
if ( j != 0 && j != 1 && j != 7 ) {
digitalWrite( 8 , LOW ) ; // sement G ON
}
else {
digitalWrite( 8 , HIGH ) ; // sement G OFF
}
// A Short Delay
delay(1);
// Reset the PORT Register to 0
PORTD = 0;
}
What are you doing here. Turning all the segments on ?
// Reset the PORT Register to 0
PORTD = 0;
Shouldn't you be switching them off ? PORTD = 255 ;
Another alternative might be to change your wiring to put segment G on arduino pin 1 and adjust the array seven_seg_val[] accordingly.