Without the details of the exact shield i will be partly guessing.
That is a little bit short notice.
No i said already that there is nothing that will do this out of the box.
The workings of the Conceptinetics are such that for break generation (and i think also detection) it changes the baudrate of the UART, and because of this it can not work as a slave and master at the same time.
What you could attempt is to combine the examples for dmx slave & dmx master, where you enable the slave, read the values you want, and disable the slave, enable the master and transmit what you want to transmit, and then disable the master. and so forth, but i am not sure if this is going to work.
1 day is really a bit short on time to make sure this is going to work, but it is worth a go.
As i stated before, it would be easier to use a board with 2 UARTs.
I looked through my own examples and did find something, but i just don't quite remember if i actually got it to work properly or not (a friend of mine was trying to achieve the same thing a couple of years back)
this was the code
#define PWM_LED_PIN 5
#define DMX_PING 13
#define MAX_DMX_CHANNELS 512
#define DMX_OUTPUT_CHANNELS 512
#define NUMBER_OF_CHANNELS 512
#define BAUDDMX 250000UL
#define TRANSMIT_FORMAT 0x0E // 8N2
#define BREAK_FORMAT 0x26 // 8E1
#define RECEIVE_FORMAT 0x06 // 8N1 (could be 8N2 aswell.
#define BAUDBREAK 49950UL // should give 176us break same as Conceptinetics
#define UBDMX ((F_CPU / (8 * BAUDDMX)) - 1)
#define UBBREAK ((F_CPU / (8 * BAUDBREAK)) - 1)
volatile uint16_t dmxaddress = 1;
volatile uint16_t i = 0;
volatile uint8_t dmxreceived = 0;
volatile uint16_t dmxcurrent = 0;
volatile uint8_t dmxvalue[NUMBER_OF_CHANNELS];
uint8_t dmxoutput[DMX_OUTPUT_CHANNELS];
volatile uint8_t dmxnewvalue = 0;
volatile uint8_t zerocounter = 0;
volatile bool storeSerial = false;
void setup() {
pinMode(PWM_LED_PIN, OUTPUT); // first dmxchannel LED value
pinMode(DMX_PING, OUTPUT); //ping LED
init_uart();
SetupTimerRegisters();
}
void loop() {
ReceiveDMX();
Processing();
SendDMX();
}
void ReceiveDMX() {
dmxnewvalue = 0;
dmxcurrent = 0;
zerocounter = 0;
i = 0;
UCSR0C = RECEIVE_FORMAT; //0x06; // 8N1
bitSet(UCSR0B, RXCIE0); // enable RX
bitSet(TIMSK2, OCIE2A);
while (dmxnewvalue != 1);
}
void Processing() { // main processing
static bool pin = true;
pin = !pin;
analogWrite(5, dmxvalue[0]);
digitalWrite(13, pin);
CopyValues();
}
void CopyValues() {
for (uint8_t j = 0; j < 3; j++) {
for (uint8_t k = 0; k < 9; k += 3) {
dmxoutput[k + j] = dmxvalue[j + 3];
}
}
}
void SendDMX() {
UCSR0C = BREAK_FORMAT; //0x06; // 8N1
UBRR0H = (UBBREAK >> 8); // set baud rate
UBRR0L = (UBBREAK & 0xFF); // HL register
uart_write(0);
UCSR0C = TRANSMIT_FORMAT; //0x0E; // 8N2
UBRR0H = (UBDMX >> 8); // set baud rate
UBRR0L = (UBDMX & 0xFF); // HL register
uart_write(0); // start code
uart_write_buffer();
}
void uart_write(char data) {
UDR0 = data;
while ((UCSR0A & 1 << TXC0) == 0);
UCSR0A |= 1 << TXC0;
}
void uart_write_buffer() {
for (uint16_t j = 0; j < DMX_OUTPUT_CHANNELS; j++) {
UDR0 = dmxoutput[j];
while ((UCSR0A & 1 << TXC0) == 0);
UCSR0A |= 1 << TXC0;
}
}
/* // Not used
void uart_write_string(const char * data) {
for (uint8_t count = 0; data[count] != 0; count++) {
UDR0 = data[count];
while ((UCSR0A & 1 << TXC0) == 0);
UCSR0A |= 1 << TXC0;
}
}*/
void init_uart() {
DDRD |= (1 << PORTD1); // set TX pin to output
DDRD &= ~(1 << PORTD0); // set RX pin to input
UCSR0A = 0x02; // 1<<U2X | 0<<MPCM;
UCSR0B = 1 << RXCIE0 | 0 << TXCIE0 | 0 << UDRIE0 | 1 << RXEN0 | 1 << TXEN0 | 0 << UCSZ02; // Enable TX & RX, disable RX interrupt
UCSR0C = RECEIVE_FORMAT; // 8N1
UBRR0H = (UBDMX >> 8); // set baud rate
UBRR0L = (UBDMX & 0xFF); // HL register
}
void SetupTimerRegisters() { // Sets up Timer2 to fire every 4us
cli();
bitClear(TCCR2A, COM2A1);
bitClear(TCCR2A, COM2A0);
bitClear(TCCR2A, COM2B1);
bitClear(TCCR2A, COM2B0);
bitSet(TCCR2A, WGM21);
bitClear(TCCR2A, WGM20);
bitClear(TCCR2B, FOC2A);
bitClear(TCCR2B, FOC2B);
bitClear(TCCR2B, WGM22);
bitClear(TCCR2B, CS22);
bitClear(TCCR2B, CS21);
bitSet(TCCR2B, CS20);
OCR2A = 64;
bitClear(TIMSK2, OCIE2B);
bitSet(TIMSK2, OCIE2A);
bitClear(TIMSK2, TOIE2);
sei();
}
ISR(TIMER2_COMPA_vect) {
if (bitRead(PIND, PIND0)) { // checks if the pin has gone HIGH
zerocounter = 0;
}
else {
zerocounter++;
if (zerocounter == 20) // if 80us have passed 'Break' has been detected
{
bitClear(TIMSK2, OCIE2A); // disable Timer2 Interrupt
storeSerial = true;
}
}
} //end Timer2 ISR
ISR(USART_RX_vect) {
/* The receive buffer (UDR0) must be read during the reception ISR, or the ISR will just
execute again immediately upon exiting. */
dmxreceived = UDR0;
if (storeSerial) {
dmxcurrent++; //increment address counter starts at 0
// and skip the start code
if (dmxcurrent > dmxaddress) { //check if the current address is the one we want.
dmxvalue[i] = dmxreceived;
i++;
if ((i == NUMBER_OF_CHANNELS) || (dmxcurrent > MAX_DMX_CHANNELS + 1 )) {
bitClear(UCSR0B, RXCIE0);
storeSerial = false;
dmxnewvalue = 1; //set newvalue, so that the main code can be executed.
}
}
}
} // end ISR
looking at the processing i think it copies 3 channels over a range 18 channels in a sort of RGB order, but the processing is not complex. I am just not really sure it actually worked ~o~ I prefer using an ESP8266 for transmission and reception these days, which will give me a lot better UI through a webserver.
Before anything else, i would want to have a proper look at your shield, to see if it actually has an input and an output transceiver, and how they are enabled, to make sure that it won't cause any damage when connecting both these ports.
In the end my friend wanted to do it his own way (which was a lot slower in response) but his method involved DMXSimple.h which does not use the UART for transmission and will require a different pinout for the shield.