17.7k views
2 votes
Test the UART transmission by writing a code that transmits the numbers 0 to 9 repetitively over

UART. Each number should appear on a new line. Introduce a small delay so the numbers don’t go too fast and flash the red LED to indicate the ongoing activity. At the same time, read any incoming data over UART. If the user types 1 on the keyboard, turn the green LED on and if the user types 2, turn the green LED off. Incorporate the three functions above in your code along with the symbolic constants definitions. A new line can be transmitted by transmitting the line feed (LF) character ‘\\’ followed by the carriage return (CR) character ‘\r’. The first character brings the cursor one line down and the second character rewinds the cursor to the leftmost colon on the screen. On the PC, open the terminal application and setup the same configuration we did at the MCU as
summarized in Table 6.1. On Windows, you can use Device Manager to find the COM port used by the backchannel UART. Some terminal applications, like TeraTerm, show the active COM ports within the application.

User Fronzee
by
6.3k points

1 Answer

3 votes

Final answer:

To test UART transmission using a microcontroller and a terminal application, write a code that transmits numbers 0 to 9 on new lines. Add a small delay between transmissions and flash the red LED. Read incoming data over UART and turn the green LED on/off based on user input.

Step-by-step explanation:

To test the UART transmission and incorporate the required functionalities, you can write a code using a microcontroller (MCU) and a terminal application on a PC.

The code should use a loop to repeatedly transmit the numbers 0 to 9 over UART. Each number should be sent on a new line by transmitting the line feed and carriage return characters ('

'
).

You can introduce a small delay between each transmission so that the numbers don't go too fast. During the transmission, you can flash the red LED on the MCU to indicate the ongoing activity.

To read incoming data over UART, you need to continuously monitor the UART input. If the user types '1' on the keyboard, you should turn on the green LED, and if the user types '2', you should turn off the green LED.

Make sure to define the symbolic constants for the LEDs and UART configuration, as mentioned in the question. Also, ensure that your terminal application is set up with the correct configuration to match the MCU's settings.

User Mlp
by
9.1k points