Fast ramp wave function is having some problems

Yesterday, I buildt a R2R ladder and it all worked fine, but as i scoped a ramp function with no delay. I discovered, that it sometimes stops for 7.4us and then goes on.
As it looks like, I get the problen every 12 waves at a random point of the wave, so the problem occurs at a rate of 1kHz. I attached the screenshot of the wave at the bottom.

The code, I use:

void setup()
{
  Serial.begin(9600);
  DDRD = B11111111; 
}
void loop()
{
  for (int i = 0; i < 255; i++) { 
    PORTD = i; 
  }  
  for (int i = 255; i > 0; i--) { 
    PORTD = i; 
  }
}

millis() interrupt?

Works,
thanks for the fast reply.