Q1. 20pts Consider a C program for an Atmel AVR that uses a UART to send 8 bytes to an RS-232 serial interface, as follows: 1: for (i=0; i<8; i++) { 2: while (!(UCSR0A & 0x20)); 3: UDR0 = x[i]; 4: } Assume the processor runs at 50 MHz; also assume that initially the UART is idle, so when the code begins executing, UCSR0A & 0x20 == 0x20 is true; further, assume that the serial port is operating at 19,200 baud. How many cycles are required to execute the above code? You may assume that the for statement executes in three cycles (one to increment i, one to compare it to 8, and one to perform the conditional branch); the while statement executes in two cycles (one to compute !(UCSR0A & 0x20) and one to perform the conditional branch); and the assignment to UDR0 executes in one cycle. In addition, you can assume that the number of cycles required to send start and stop bits is negligible and the time to transmit 1 byte data and the time to satisfy the condition of the while statement are almost the same (to simplify this question).
Added by Zachary T.
Close
Step 1
The for loop executes 8 times (for each byte to be sent). Show more…
Show all steps
Your feedback will help us improve your experience
Akash M and 94 other AP CS educators are ready to help you.
Ask a new question
Labs
Want to see this concept in action?
Explore this concept interactively to see how it behaves as you change inputs.
Key Concepts
Recommended Videos
1. Which mode of operation is exhibited by RS-485 standard? a) Single-ended b) Differential c) Both a and b d) None of the above 2. What is the purpose of an In-Circuit Debugger (ICD)? a) Specific debugging capabilities b) Allows the operation of the microprocessor to be controlled externally c) Provide full control over all aspects of the microprocessor d) Both a and c 3. Which is the most commonly used language(s) used in embedded systems? a) C b) C++ c) Java d) C# 4. Reserved memory for an integer is a) 1 byte b) 2 bytes c) Compiler dependent d) 4 bytes 5. Example of a synchronous bus a) USB b) SPI c) UART d) MBUS
Sri K.
Adi S.
Aarya B.
Recommended Textbooks
Computer Science and Information Technology
Introduction to Programming Using Python
Computer Science - An Overview
Transcript
Watch the video solution with this free unlock.
EMAIL
PASSWORD