Re: UART Register manipulation
Posted: Fri Feb 05, 2016 10:14 pm
I am working on a similar project and stumbled across this page. I use a different approach to sending the break and MAB... I pinched the idea from the dmxSerial library by Matthias Hertel. He simply changes the serial baud to 10k with 8e1 coding, writes a 0, then switches back to 250k 8n2 coding. It works perfectly.
I am currently working on making my code work using interrupts to send the data as I want to output 2 universes and it's too slow using the main loop.
Code: Select all
// Ensure all data is sent
Serial1.flush();
delay(2);
Serial1.end();
// Send Break & MAB
Serial1.begin(10000, SERIAL_8E1);
Serial1.write(0);
Serial1.flush();
Serial1.end();
// Send DMX start code 0
Serial1.begin(250000, SERIAL_8N2);
Serial1.write(0);
// Now send DMX data
for (int x = 0, x < maxChans, x++)
Serial1.write(dmxData[x]);
I am currently working on making my code work using interrupts to send the data as I want to output 2 universes and it's too slow using the main loop.