problems with UART send/receive

Hi,
i am trying to send and receive data over a 9 bit serial communication (MDB 1start, 8data, 1 mode, 1 stop).
I encountered the problem that i receive the exact same bytes as i send, is there any error in my code?
I thought that writing to the UDRn register would transmit the data.

void mdb_uart_init()
{
  UCSR1B = (1<<RXEN1)|(1<<TXEN1);
  UBRR1H = 0;
  UBRR1L = 103; // 9600baud
  UCSR1C |= (1<<UCSZ11)|(1<<UCSZ10); //9bit mode
  UCSR1B |= (1<<UCSZ12); //also for 9 bit mode
  UCSR1C = UCSR1C | B00000100; //one stop bit
  UCSR1C = UCSR1C | B00000000; //no parity bit
}

int receive(unsigned char *data, int *mode)
{
  unsigned char status, resh, resl;
  if(!(UCSR1A & (1<<RXC))) 
  {
    Serial.println("NO DATA TO READ");
    return 0;
  }
  status = UCSR1A;
  resh = UCSR1B;
  resl = UDR1;

  if (status & ((1<<FE) | (1<<DOR) | (1<<UPE)))
  {
    Serial.println("STATUS ERROR");
    return 0;
  }
  
  (*mode) = (resh >> 1) & 0x01;
  (*data) = resl; 
  return 1;
}

void send(unsigned char cmd, int mode)
{
  while(!(UCSR1A & (1<<UDRE)));
  UCSR1B &= ~(1<<TXB8);
  if (mode)
    UCSR1B |= (1<<TXB8); //set mode bit
  UDR1 = cmd;
}

greetings Tarcontar

I encountered the problem that i receive the exact same bytes as i send,

Yes?

Mark

Ok that was milseading, sorry.

The problem is that i talk to a MDB coin changer. And the response should NOT be the exact same bytes as I send. It should be a specific response from that device.

I seems that I just write to the register and in the receive method I read the excact same data. As if ther e is nothing send and nothing received at all.

Tarcontar

It's always the cables...

so there is nothing wrong with my send/receive and setup code?