added unsigned

This commit is contained in:
hugo LAMY
2025-03-06 22:26:50 +01:00
parent 638f1d2a68
commit 9e9dcae5e3

View File

@@ -91,8 +91,8 @@
// 20.4 Frame Formats : 8N1 : 8 data bits, no parity, 1 stop bit
// 20.5 USART Initialization : (1) setting baud rate, (2) setting frame format, (3) enabling the Transmitter or the Receiver
void uart_init() {
UBRR0H = BAUD_PRESCALER >> 8; // 20.11.5 : UBRRnL and UBRRnH USART Baud Rate Registers
UBRR0L = BAUD_PRESCALER;
UBRR0H = (unsigned char) (BAUD_PRESCALER >> 8); // 20.11.5 : UBRRnL and UBRRnH USART Baud Rate Registers
UBRR0L = (unsigned char) BAUD_PRESCALER;
UCSR0C = ASYNCHRONOUS | PARITY_DISABLED | STOP_ONE_BIT | DATA_EIGHT_BIT; // 20.11.4 : set Frame Format
@@ -101,7 +101,7 @@ void uart_init() {
void uart_tx(char c) {
while (TEST(UCSR0A, UDRE0) == 0); // 20.11.2 : do nothing until UDR emission buffer is empty, if UDREn flag is 1, UCSRnA register is empty
UDR0 = c; // 20.11.1 : Put data into buffer, UDRn USART I/O Data Register (read and write)
UDR0 = (unsigned char) c; // 20.11.1 : Put data into buffer, UDRn USART I/O Data Register (read and write)
}
int main() {