Hi,
I want to write a program that allows me to read a sum signal from my RC-receiver.
Here is my code:
volatile unsigned char cSumSig[8]; //Array to store the channels
volatile uint8_t iCounter=0,iValid=0;
//***************************************************************
//If I delete this code then Arduino compiles
ISR(TIMER0_OVF_vect) {
iCounter=0; // Reset Counter on Overflow
iValid=0; // "disable" Timer 'till next rising
}
//***************************************************************
ISR(INT0_vect) {
if(iValid==1) { // don't count before first pulse
cSumSig[iCounter] = TCNT0; // save pulse length
iCounter++; // increase counter
} else {
iValid = 1; // "enable" Timer after first pulse
}
TCNT0 = 0; // reset Timer
}
void setup() {
Serial.begin(9600);
TIMSK0 |= (1<<TOIE0); // Overflow Interrupt enable
TCCR0A |= ((1<<CS00) | (1<<CS02)); // Prescaler 128
TCNT0 = 0; // Overflow between 2,2ms & 3,8ms
EIMSK |= (1<<INT0); // INT0 enable
EICRA |= ((1<<ISC01) | (1<<ISC00)); // external Interrupt on rising
sei(); // enable global interrupts
}
void loop() {
Serial.println('test'); //just a test - i want to display the channels here later
}
arduino gives me the following debug information:
/tmp/build3799302546627044279.tmp/core.a(wiring.c.o): In function `init':
/usr/share/arduino/hardware/arduino/cores/arduino/wiring.c:160: multiple definition of `__vector_16'
o:/tmp/build3799302546627044279.tmp/susi.cpp:26: first defined here
Can somebody help me please? I just cant see any reason why it is not working...
Greets
Damian