Gast
#1213938
Guten Tag allerseits,
ich möchte auf einem ATtiny2313 die DMX-Empfangsroutine von Hendrik
Hölscher (danke übrigens) zum Laufen bringen. Allerdings noch ohne
Erfolg.
Folgender Code:
//DMX-Empfangsroutine
ISR (UART_RX_vect)
{
uint8_t USARTstate= UCSRA; //get state
uint8_t DmxByte= UDR; //get data
uint8_t DmxState= gDmxState; //just get once from SRAM!!!
if (USARTstate &(1<<FE)) //check for break
{
UCSRA &= ~(1<<FE); //reset flag
DmxCount= DmxAddress; //reset frame counter
gDmxState= BREAK;
}
else if (DmxState == BREAK)
{
if (DmxByte == 0)
{
gDmxState= STARTB; //normal start code detected
gDmxPnt= ((uint8_t*)DmxField +1);
}
else gDmxState= IDLE;
}
else if (DmxState == STARTB)
{
if (--DmxCount == 0) //start address reached?
{
gDmxState= STARTADR;
DmxField[0]= DmxByte;
}
}
else if (DmxState == STARTADR)
{
uint8_t *DmxPnt;
DmxPnt= gDmxPnt;
*DmxPnt= DmxByte;
if (++DmxPnt >= (DmxField +DMX_CHANNELS)) //all ch received?
{
gDmxState= IDLE;
}
else gDmxPnt= DmxPnt;
}
}
//**********************************************************************
*********************
//DMX Reception Initialisation
void init_DMX(void)
{
UBRRH = 0;
UBRRL = ((F_OSC/4000)-1); //250kbaud, 8N2
UCSRC |= (3<<UCSZ0)|(1<<USBS);
UCSRB |= (1<<RXEN)|(1<<RXCIE);
gDmxState= IDLE;
uint8_t i;
for (i=0; i<DMX_CHANNELS; i++)
{
DmxField[i]= 0;
}
}
Ich habe nur die Interruptroutine und die Funktion zur Initialisierung
angehängt.
Der Compiler spuckt nun immer die Warnung aus "../dmx_splitter_2.c:36:
warning: 'UART_RX_vect' appears to be a misspelled signal handler".
Wo könnten meine Fehler liegen? Es werden keine DIP-Schalter zur
Adresseingabe ausgelesen (diese bleibt immer auf 1).
Was muss ich noch alles ändern? Wo habe ich Fehler? HIILLFEEEE!!
Danke