0
0
Embedded Cprogramming~10 mins

Transmitting a byte over UART 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 send a byte using UART.

Embedded C
void UART_SendByte(char data) {
    while (!(UART_STATUS & [1]));
    UART_DATA = data;
}
Drag options to blanks, or click blank then click option'
AUART_TX_READY
BUART_OVERRUN
CUART_ERROR
DUART_RX_READY
Attempts:
3 left
💡 Hint
Common Mistakes
Using the receiver ready flag instead of transmitter ready.
Checking for error flags instead of readiness.
2fill in blank
medium

Complete the code to wait until UART is ready before sending.

Embedded C
void UART_SendByte(char data) {
    while ((UART_STATUS & [1]) == 0);
    UART_DATA = data;
}
Drag options to blanks, or click blank then click option'
AUART_RX_READY
BUART_PARITY_ERROR
CUART_TX_READY
DUART_FRAME_ERROR
Attempts:
3 left
💡 Hint
Common Mistakes
Checking the wrong UART status flag.
Using equality instead of bitwise AND.
3fill in blank
hard

Fix the error in the UART byte transmission code.

Embedded C
void UART_SendByte(char data) {
    while (UART_STATUS & [1]);
    UART_DATA = data;
}
Drag options to blanks, or click blank then click option'
AUART_ERROR
BUART_TX_BUSY
CUART_RX_READY
DUART_TX_READY
Attempts:
3 left
💡 Hint
Common Mistakes
Waiting for the ready flag instead of the busy flag.
Using receiver flags instead of transmitter flags.
4fill in blank
hard

Fill both blanks to create a UART send function that waits for transmitter ready and then sends data.

Embedded C
void UART_SendByte(char data) {
    while (!(UART_STATUS & [1]));
    UART_DATA = [2];
}
Drag options to blanks, or click blank then click option'
AUART_TX_READY
Bdata
CUART_RX_READY
DUART_ERROR
Attempts:
3 left
💡 Hint
Common Mistakes
Using receiver ready flag instead of transmitter ready.
Assigning the wrong variable to UART_DATA.
5fill in blank
hard

Fill all three blanks to implement UART byte transmission with a busy wait and data assignment.

Embedded C
void UART_SendByte(char data) {
    while (UART_STATUS & [1]);
    UART_DATA = [2];
    UART_STATUS |= [3];
}
Drag options to blanks, or click blank then click option'
AUART_TX_BUSY
Bdata
CUART_TX_READY
DUART_TX_INTERRUPT_FLAG
Attempts:
3 left
💡 Hint
Common Mistakes
Not waiting for the busy flag before sending.
Not clearing the interrupt flag after transmission.