I'm trying to write several values to UDR1 to send out the USART1 on an ATMega2561 using JTAG ICE MkII and AVR Studio 4.18, but they never show up in the register, even if I disable transmit. I've also tried reading UDR1 to a variable immediately after writing and it stays at 0, so it really doesn't look like anything's getting there. What might be causing this? Here's my initialization and operating code; thanks for your help:
//UART1 initialize // desired baud rate:9600 // actual baud rate:9615 (0.2%) // char size: 8 bit // parity: Disabled void uart1_init(void) { UCSR1B = 0x00; //disable while setting baud rate UCSR1A = 0x00; UCSR1C = 0x06; UBRR1L = 0x67; //set baud (9600) rate lo UBRR1H = 0x00; //set baud (9600) rate hi UDR1 = 0; // Clear transmit register UCSR1B = 0x08; // Enable transmit // UCSR1B = 0; // Disable transmit } while ((UCSR1A & (1 <<UDRE1)) == 0); // Wait until UDR is empty UDR1 = 0x80; // Init byte while ((UCSR1A & (1 <<UDRE1)) == 0); // Wait until UDR is empty UDR1 = 0; // Servo number while ((UCSR1A & (1 <<UDRE1)) == 0); // Wait until UDR is empty UDR1 = 4; // Command: Set position, absolute while ((UCSR1A & (1 <<UDRE1)) == 0); // Wait until UDR is empty UDR1 = LEFT_0_D1; // Send high bits of position