I use the Arduino IDE 1.6.9
What I want is a DMX Receiver which receives 1 channel and displays it on the serial monitor. When I try to compile the code, I get the following error:
C:\Users\Helyx\AppData\Local\Temp\build25a76891c667e0896ec10beb77bd0478.tmp/core\core.a(HardwareSerial0.cpp.o): In function `__vector_25':
D:\Programme\Arduino\hardware\arduino\avr\cores\arduino/HardwareSerial0.cpp:48: multiple definition of `__vector_25'
sketch\DmxReceive.ino.cpp.o:C:\Users\Helyx\Documents\Arduino\DmxReceive/DmxReceive.ino:26: first defined here
d:/programme/arduino/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/bin/ld.exe: Disabling relaxation: it will not work with multiple definitions
collect2.exe: error: ld returned 1 exit status
exit status 1
Fehler beim Kompilieren.
Any ideas? Here is my code:
#include <avr/interrupt.h>
#include <avr/io.h>
#include <stdio.h>
#define F_CPU 16000000
#define DMX_BAUD 250000
#define DMX_LOST_TIMEOUT 8000
volatile unsigned char dmx_buffer[10];
volatile unsigned int dmx_lost = DMX_LOST_TIMEOUT;
volatile unsigned int dmx_adresse = 1;
ISR (USART0_RX_vect)
{
static unsigned int dmx_channel_rx_count = 0;
static unsigned char dmx_valid = 0;
unsigned char tmp = 0;
tmp = UDR0;
if(UCSR0A&(1<<FE0))
{
if(dmx_channel_rx_count > 1)
{
dmx_lost = 0;
}
dmx_channel_rx_count = 0;
dmx_buffer[0] = tmp;
if(dmx_buffer[0] == 0)
{
dmx_valid = 1;
dmx_channel_rx_count++;
}
else
{
dmx_valid = 0;
}
return;
}
if(dmx_valid)
{
dmx_buffer[dmx_channel_rx_count] = tmp;
if(dmx_channel_rx_count < 514)
{
dmx_channel_rx_count++;
}
return;
}
}
ISR (TIMER2_COMPA_vect)
{
if(dmx_lost<DMX_LOST_TIMEOUT)
{
dmx_lost++;
}
}
void setup()
{
EICRA |= (1<<ISC11)|(1<<ISC10); //The rising edge of INT1 generates an interrupt request
EIMSK |= (1<<INT1); //External interrupt request 1 enable
//Init usart DMX-BUS
UBRR0 = (F_CPU / (DMX_BAUD * 16L) - 1);
UCSR0B|=(1 << RXEN0 | 1<< RXCIE0);
UCSR0C|=(1<<USBS0); //USBS0 2 Stop bits
sei();//Globale Interrupts Enable
TCCR2A |= (1<<WGM21);
TCCR2B |= (1<<CS22|1<<CS21|1<<CS20);
TIMSK2 |= (1<<OCIE2A);
OCR2A = F_CPU/1024/1000 - 1; //Tick 1ms
Serial.begin(57600);
DDRC = (1<<PE3);
PORTB |= 0x3F;
PORTC |= 0xFF;
PORTC &=~(1<<PE3);
}
void loop()
{
if(dmx_lost==DMX_LOST_TIMEOUT)
{
dmx_buffer[dmx_adresse] = 0;
}
Serial.print(dmx_buffer[dmx_adresse]);
}