#include #include #include //INPUT PINS digital 2-7 PIND #define PIND_MASK B11111100 //INPUT PINS digitat 8-12 PINB #define PINB_MASK B00011111 //INPUT PINS analog 0-4 PINC #define PINC_MASK B00011111 #define INPUT_SIG_PORTD B11000000 #define INPUT_SIG_PORTB B00011111 #define INPUT_SIG_PORTC B00010000 #define OUTPUT_SIG_PORTB ( PINB_MASK & ~INPUT_SIG_PORTB ) // B00011111 & ! B00011111 = 0 #define OUTPUT_SIG_PORTC ( PINC_MASK & ~INPUT_SIG_PORTC ) // B00011111 & ! B00010000 = B00001111 #define OUTPUT_SIG_PORTD ( PIND_MASK & ~INPUT_SIG_PORTD ) // B11111100 & ! B11000000 = 00111100 union union16 { byte uint8[2]; uint16_t uint16; }; union union32 { byte uint8[4]; uint16_t uint16[2]; uint32_t uint32; }; //********************************************************************// typedef unsigned char byte; //********************************************************************// /* void start_timer() { // timer 1: 2 ms TCCR1A = 0; // prescaler 1:8, WGM = 4 (CTC) TCCR1B = 1< 0.08ms @ 16 MHz -> 1*alpha // OCR1A = 207; // (1+207)*8 = 1664 -> 0.104ms @ 16 MHz -> 1*alpha TCNT1 = 0; // reseting timer TIMSK1 = 1<