2 #include <avr/interrupt.h>
5 //INPUT PINS digital 2-7 PIND
6 //INPUT PINS digitat 8-12 PINB
7 //INPUT PINS analog 0-4 PINC
10 //********************************************************************//
12 typedef unsigned char byte;
14 //********************************************************************//
19 TCCR1A = 0; // prescaler 1:8, WGM = 4 (CTC)
20 TCCR1B = 1<<WGM12 | 1<<CS11; //
21 OCR1A = 159; // (1+159)*8 = 1280 -> 0.08ms @ 16 MHz -> 1*alpha
22 // OCR1A = 207; // (1+207)*8 = 1664 -> 0.104ms @ 16 MHz -> 1*alpha
23 TCNT1 = 0; // reseting timer
24 TIMSK1 = 1<<OCIE1A; // enable Interrupt
27 void stop_timer() // stop the timer
30 TCCR1B = 0; // no clock source
31 TIMSK1 = 0; // disable timer interrupt
34 ISR(TIMER1_COMPA_vect)
42 // pinMode(RF433_PIN, INPUT); // set pin to input
43 // digitalWrite(RF433_PIN, LOW); // turn of pullup resistors
53 Serial.println("starting timer");
62 //INPUT PINS digital 2-7 PIND
63 //INPUT PINS digitat 8-12 PINB
64 //INPUT PINS analog 0-4 PINC
67 // Serial.println("foo");
73 data.uint8[0]|= (PINC & B11111);
75 data.uint8[0]|= (PINB & B11111);
76 Serial.print(data.uint8[0]);
77 Serial.print(data.uint8[1]);