#include <avr/io.h>
#include <stdint.h>
#define sbi(b,n) (b |= (1<<n)) /* Set bit number n in byte b */
#define cbi(b,n) (b &= (~(1<<n))) /* Clear bit number n in byte b */
#define fbi(b,n) (b ^= (1<<n)) /* Flip bit number n in byte b */
register uint8_t counter1 asm("r2");
register uint8_t counter2 asm("r3");
register uint8_t counter3 asm("r4");
register uint8_t counter4 asm("r5");
register uint8_t counter5 asm("r6");
register uint8_t counter6 asm("r7");
register uint8_t counter7 asm("r8");
register uint8_t counter8 asm("r9");
register uint8_t counter9 asm("r10");
register uint8_t counter10 asm("r11");
register uint8_t counter11 asm("r12");
register uint8_t counter12 asm("r13");
const uint8_t top[12] = {112, 119, 126, 134, 141, 150, 159, 168, 178, 189, 200, 212};
int main(void)
{
while(1)
{
/* Decrement each counter */
counter1--;
counter2--;
counter3--;
counter4--;
counter5--;
counter6--;
counter7--;
counter8--;
counter9--;
counter10--;
counter11--;
counter12--;
/* Check if counter is zero */
if (counter1 == 0) {counter1 = 112; fbi(PORTB, 0);}
if (counter2 == 0) {counter2 = 119; fbi(PORTB, 0);}
if (counter3 == 0) {counter3 = 126; fbi(PORTB, 0);}
if (counter4 == 0) {counter4 = 134; fbi(PORTB, 0);}
if (counter5 == 0) {counter5 = 141; fbi(PORTB, 0);}
if (counter6 == 0) {counter6 = 150; fbi(PORTB, 0);}
if (counter7 == 0) {counter7 = 159; fbi(PORTB, 0);}
if (counter8 == 0) {counter8 = 168; fbi(PORTB, 0);}
if (counter9 == 0) {counter9 = 178; fbi(PORTB, 0);}
if (counter10 == 0) {counter10 = 189; fbi(PORTB, 0);}
if (counter11 == 0) {counter11 = 200; fbi(PORTB, 0);}
if (counter12 == 0) {counter12 = 212; fbi(PORTB, 0);}
}
}