// create timings by non blocking loop #include #define F_CPU 16000000UL //must be defined prior to delay.h #include #define A PORTB7 #define B PORTB6 #define C PORTB5 #define MAX 14 void setup(); int main(){ setup(); uint8_t signals[] ={1,2,3}; static uint8_t n = 0; uint16_t time = 0; const uint16_t countMS = 160; //magic number found by simulation //this number depends on optimization mode!!! while(1){ // n = n % sizeof(signals)/sizeof(signals[0]); //periodic by 14 n = n % 3; // much faster than previous line if (time == countMS){ // PORTB = signals[n++]<<5; //shift bit pattern to correct position time=0; } time++; } } void setup(){ DDRB |= (1<