1. Determine the value in R17 for the following AVR instructions: LDI R17, (1<<7) NEG R17 LDI R17, ($CC>>2) ORI R17, SAA LDI R17, $7F LDI R16, $7B ADD R17, R17 LDI R17, $4A LDI R16, $B3 ADD R17, R16 ADC R17, R16 ROR R17 LSL R17 R17 = R17 = R17 = R17 = 2. Fill in the values in the data RAM locations specified for the following AVR code: LDI R20, LDI R21, 0 6 5 4 Addres 7 3 2 1 LDI R16, $56 LDI R17, $78 LDI R18, $12 LDI R19, $34 SUB R18, R16 $200 $201 $202 SBC R19, R17 SBC R20, R21 STS $200, R18 STS $201, R19 STS $202, R20 | 3. The number $5678 resides in data RAM $300 and $301 in little endian order. The number $1234 resides in data RAM at $302 and $303 (little endian). Write AVR code that divides the first number by the second and stores the result in $400, $401. 4. It is desired to configure a PWM Output Pin on an ATmega328P. Write the AVR Assembly code that will set up an output pin for one of the 8-bit timers (Timer0 or Timer2) to meet the following specification: Phase Correct PWM, TOP = $FF, Output is NON-INVERTED, PWM frequency is 980 Hz and the duty cycle is 33%. 5. A temperature sensor creates an output current proportional to temperature with the following constant: 1 mA / °C. (mA is milli-ampere, le-3 amps) The sensor is terminated in a 30- ohm resistor, creating a measurable voltage. It is desired to input this voltage into a 10-bit ADC with a reference voltage of 3.3 volts, measuring water temperatures between freezing and boiling. Assume that the code to set up and run an ADC conversion has been written and the results reside in the ADCL, ADCH registers. Write the AVR assembly code to convert the 10-bit ADC readings ($0000 – $03FF possible) into an unsigned $HEX number corresponding to the temperature value in Celsius, storing the result is $200. Example: Temperature is 25°C, sensor makes a voltage of 0.75 volts, producing an ADCH:ADCL reading of $0E8 (23210) and the value to be stored is $19 [Use may use this ratio, 232 bits to 25°C = 9.3, as the mapping ratio in your divide loop]

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question
1.
Determine the value in R17 for the following AVR instructions:
LDI R17, (1<<7)
NEG R17
LDI R17, ($CC>>2)
ORI R17, ŠAA
LDI R17, $7F
LDI R16, $7B
ADD R17, R17
LDI R17, $4A
LDI R16, $B3
ADD R17, R16
ADC R17, R16
ROR R17
LSL R17
R17 =
R17 =
R17 =
R17 =
2.
Fill in the values in the data RAM locations specified for the following AVR code:
LDI R20, 0
1, 0
LDI R16, $56
LDI R17, $78
LDI R18, $12
LDI R19, $34
Addres
7
4
3
2
1
LDI
S
$200
$201
SUB R18, R16
SBC R19, R17
$202
SBC R20, R21
STS $200, R18
STS $201, R19
STS $202, R20
|
3.
The number $5678 resides in data RAM $300 and $301 in little endian order. The
number $1234 resides in data RAM at $302 and $303 (little endian). Write AVR code that divides
the first number by the second and stores the result in $400, $401.
4.
It is desired to configure a PWM Output Pin on an ATmega328P. Write the AVR Assembly
code that will set up an output pin for one of the 8-bit timers (Timer0 or Timer2) to meet the
following specification: Phase Correct PWM, TOP = $FF, Output is NON-INVERTED, PWM
frequency is 980 Hz and the duty cycle is 33%.
5.
A temperature sensor creates an output current proportional to temperature with the
following constant: 1 mA / °C. (mA is milli-ampere, le-3 amps) The sensor is terminated in a 30-
ohm resistor, creating a measurable voltage. It is desired to input this voltage into a 10-bit ADC
with a reference voltage of 3.3 volts, measuring water temperatures between freezing and
boiling. Assume that the code to set up and run an ADC conversion has been written and the
results reside in the ADCL, ADCH registers. Write the AVR assembly code to convert the 10-bit
ADC readings ($0000 – $03FF possible) into an unsigned $HEX number corresponding to the
temperature value in Celsius, storing the result is $200.
Example: Temperature is 25°C, sensor makes a voltage of 0.75 volts, producing an ADCH:ADCL
reading of $0E8 (23210) and the value to be stored is $19 [Use may use this ratio, 232 bits to
25°C = 9.3, as the mapping ratio in your divide loop]
Transcribed Image Text:1. Determine the value in R17 for the following AVR instructions: LDI R17, (1<<7) NEG R17 LDI R17, ($CC>>2) ORI R17, ŠAA LDI R17, $7F LDI R16, $7B ADD R17, R17 LDI R17, $4A LDI R16, $B3 ADD R17, R16 ADC R17, R16 ROR R17 LSL R17 R17 = R17 = R17 = R17 = 2. Fill in the values in the data RAM locations specified for the following AVR code: LDI R20, 0 1, 0 LDI R16, $56 LDI R17, $78 LDI R18, $12 LDI R19, $34 Addres 7 4 3 2 1 LDI S $200 $201 SUB R18, R16 SBC R19, R17 $202 SBC R20, R21 STS $200, R18 STS $201, R19 STS $202, R20 | 3. The number $5678 resides in data RAM $300 and $301 in little endian order. The number $1234 resides in data RAM at $302 and $303 (little endian). Write AVR code that divides the first number by the second and stores the result in $400, $401. 4. It is desired to configure a PWM Output Pin on an ATmega328P. Write the AVR Assembly code that will set up an output pin for one of the 8-bit timers (Timer0 or Timer2) to meet the following specification: Phase Correct PWM, TOP = $FF, Output is NON-INVERTED, PWM frequency is 980 Hz and the duty cycle is 33%. 5. A temperature sensor creates an output current proportional to temperature with the following constant: 1 mA / °C. (mA is milli-ampere, le-3 amps) The sensor is terminated in a 30- ohm resistor, creating a measurable voltage. It is desired to input this voltage into a 10-bit ADC with a reference voltage of 3.3 volts, measuring water temperatures between freezing and boiling. Assume that the code to set up and run an ADC conversion has been written and the results reside in the ADCL, ADCH registers. Write the AVR assembly code to convert the 10-bit ADC readings ($0000 – $03FF possible) into an unsigned $HEX number corresponding to the temperature value in Celsius, storing the result is $200. Example: Temperature is 25°C, sensor makes a voltage of 0.75 volts, producing an ADCH:ADCL reading of $0E8 (23210) and the value to be stored is $19 [Use may use this ratio, 232 bits to 25°C = 9.3, as the mapping ratio in your divide loop]
Expert Solution
steps

Step by step

Solved in 2 steps with 2 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY