0
0
Embedded Cprogramming~10 mins

Baud rate configuration in Embedded C - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to set the baud rate register to 9600 baud assuming F_CPU is 16MHz.

Embedded C
UBRR0H = ([1] >> 8);
Drag options to blanks, or click blank then click option'
A51
B207
C103
D16
Attempts:
3 left
💡 Hint
Common Mistakes
Using the wrong UBRR value for 9600 baud at 16MHz.
2fill in blank
medium

Complete the code to enable the transmitter in the UART control register.

Embedded C
UCSR0B = (1 << [1]);
Drag options to blanks, or click blank then click option'
ARXEN0
BTXCIE0
CRXCIE0
DTXEN0
Attempts:
3 left
💡 Hint
Common Mistakes
Confusing receiver enable (RXEN0) with transmitter enable.
3fill in blank
hard

Fix the error in the code to set the baud rate low byte correctly.

Embedded C
UBRR0L = [1] & 0xFF;
Drag options to blanks, or click blank then click option'
AUBRR0L
BUBRR_VALUE
CUBRR0H
DUBRR
Attempts:
3 left
💡 Hint
Common Mistakes
Using the wrong register or variable for the low byte.
4fill in blank
hard

Fill both blanks to configure UART for 8 data bits and no parity.

Embedded C
UCSR0C = (1 << [1]) | (1 << [2]);
Drag options to blanks, or click blank then click option'
AUCSZ01
BUCSZ02
CUCSZ00
DUPM01
Attempts:
3 left
💡 Hint
Common Mistakes
Setting parity bits instead of data size bits.
5fill in blank
hard

Fill all three blanks to calculate and set the baud rate registers correctly.

Embedded C
uint16_t [1] = (F_CPU / (16 * [2])) - 1;
UBRR0H = ([1] >> 8);
UBRR0L = [1] & 0xFF;
Drag options to blanks, or click blank then click option'
Aubrr_value
Bbaud_rate
Dbaud
Attempts:
3 left
💡 Hint
Common Mistakes
Using inconsistent variable names for baud rate and UBRR value.