#define F_CPU 8000000 #define BAUD 250000L // DMX512, hardware UART #define BAUD_SOFT_UART 9600 // software UART #define BIT_TIME (F_CPU/BAUD_SOFT_UART) #define TEST_LOW PORTB &= ~(1<10) || (BAUD_ERROR<-10)) #error Systematic baud error above 1% which is too high! #endif #if (BIT_TIME > 0xFFFF) #error Soft UART baud rate too low! #endif #define BAUD_REAL_SOFT (F_CPU/BIT_TIME) #define BAUD_ERROR_SOFT ((BAUD_REAL_SOFT*1000)/BAUD_SOFT_UART-1000) #if ((BAUD_ERROR_SOFT>10) || (BAUD_ERROR_SOFT<-10)) #error Systematic baud error of soft UART above 1% which is too high! #endif