Unusual or Strange Behavior: uint8_t in for loop in avr MCU
You arrive to the point where the value of i is o.
i &gt;= 0 is true.
You try to decrement with i--.  Perhaps, you are expecting a negative number.  But i is unsigned, so you get 255.
It keep decrementing until you get to zero.  Then everything repeats again.

If i were signed, then the loop would make 9 iterations.

The following code does not have this ill effect.  Notice the strict inequality.  This loop will iterate 8 times.

for (uint8_t i = 8;  i &gt; 0;  i--) { // strictly greater
    // [...]
}