Hi
arduino only receives the first 24channels of the dxm data.
please help me to find the failure:
i used the following code to receive dmx:
#define myubbr (16000000L/16/250000-1)
volatile int DMXChannel = 0;
static unsigned char DMX[512];
ISR(USART_RX_vect) {
char temp,temp1;
temp1 = UCSR0A;
temp = UDR0&0xFF;
if ((temp1 & (1<<FE0))||temp1 & (1<<DOR0)) //Break
{
DMXChannel = 0;
return;
}
else if (DMXChannel<(char)25)
{
digitalWrite(ledPin,HIGH);
DMX[DMXChannel++]=temp&0xFF;
}
digitalWrite(ledPin,LOW);
}
void setup() { );
delay(100);
UBRR0H = (unsigned char)(myubbr>>8);
UBRR0L = (unsigned char)myubbr;
UCSR0B |= ((1<<RXEN0)|(1<<RXCIE0));//Enable Receiver and Interrupt RX
UCSR0C |= (3<<UCSZ00);//N81
this is the code regarding the dmx reception.
anyone a suggestion why i can only receiv the first 24 channels?