EE234_hw02_Sol_24S
docx
keyboard_arrow_up
School
Western Washington University *
*We aren’t endorsed by this school
Course
234
Subject
Electrical Engineering
Date
Apr 3, 2024
Type
docx
Pages
3
Uploaded by zerogaming0723
EE234 Homework 2
Due
: 02/02/2024 (Thursday)
Save your answer in word format
and using the file name “
EE234_HW2_LastName_FirstName
”
1. Write an instruction sequence to subtract the 16-bit value stored at program memory 0x1050~0x1051 from the sum of two 16-bit values stored at program memory 0x1060~0x1061 and 0x1070~0x1071. Store the result at data memory 0x2000~0x2001.
Solution:
ldi
ZL,0x60
ldi
ZH, 0x10
lpm
r0, Z+
lpm
r1, Z
ldi
ZL, 0x70
ldi
ZH, 0x10
lpm
r2, Z+
lpm
r3, Z
add
r0, r2
adc
r1, r3
ldi
ZL, 0x50
ldi
ZH, 0x10
lpm
r4, Z+
lpm
r5, Z
sub
r0, r4
sbc
r1, r5
sts
0x2000, r0
sts
0x2001, r1
2. Write an instruction sequence to multiply the 16-bit unsigned value stored
at program memory 0x1050~0x1051 and the 16-bit value stored in r5~r6 register pair and store the product in data memory from 0x2020~0x2023. Call the subroutine mul16U to perform the multiplication.
Solution:
ldi
ZL, 0x50
ldi
ZH, 0x10
lpm
r16, Z+
lpm
r17, Z
mov
r18, r5
mov
r19, r6
call
mul16U
sts
0x2020, r22
sts
0x2021, r23
sts
0x2022, r24
sts
0x2023, 0xr25 3. Write a program to read every element from an array in program memory (with the label sarr
), set bit 7, clear bit 6, and set bit 2, and then store the result in data memory (starting from 0x2000). The array elements are 8-bit. The array has 30 elements.
Solution:
.include <atxmega128A1Udef.inc>
.equ
sbMask = 0x84
.equ
cbMask = 0x40
.equ
NN = 30
.def
lpCnt = r19
.dseg
.org
0x2000
.byte
30
.cseg
.org
0x00
jmp
start
.org
0xFA
start: ldi
ZL, low(sarr << 1)
ldi
ZH, high(sarr << 1)
ldi
XL, 0
ldi
XH, 0x20
ldi
lpCnt, NN
clr
cnt
loop:
lpm
r16, Z+
sbr
r16, sbMask
cbr
r16, cbMask
st
X+, r16
dec
lpCnt
brne
loop
here:
jmp
here
sarr:
.db
0x11, 0x12, 0x13, 0x14, 0x15, ox16, 0x17, 0x18, 0x19, 0x20
.db
0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x30
.db
0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x40
4. Write an instruction sequence to call the subroutine mul16S
to compute the product of 0x5678
and 0x9DCA
and store the product in data memory at 0x2000~0x2003. Solution:
ldi
r16, low(0x5678)
ldi
r17, high(0x5678)
ldi
r18, low(0x9DCA)
ldi
r19, high(0x9DCA)
call
mul16S
sts
0x2000, r22
sts
0x2001, r23
sts
0x2002, r24
sts
0x2003, r25
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
- Access to all documents
- Unlimited textbook solutions
- 24/7 expert homework help
Related Documents
Related Questions
The numbers from 0-9 and a no characters
is the Basic 1 digit seven segment display
* .can show
False
True
In a (CA) method of 7 segments, the
anodes of all the LED segments are
* "connected to the logic "O
False
True
Some times may run out of pins on your
Arduino board and need to not extend it
* .with shift registers
True
False
arrow_forward
Please answer in typing format
arrow_forward
question1:In a memory system, data is 16-bit wide. Break the information into bytes with their addresses using little endian and big-endian methods. Starting address is F800 and the data is: E0F2 0041
question2:What acknowledgment signals are there in I2C bus?
arrow_forward
To select the ROM the address lines A10-A9 should be:
A. 00
B. 01
C. 10
D.10
arrow_forward
6- Set BX to 4567H, CX to FEDCH and SP to A59FH, then run the instructions:
PUSH BX
PUSH CX
a. What is the new value of SP ?
b. Display the memory locations where you pushed the values of BX and CX in
the stack.
arrow_forward
Question in photo please ASAP Hand written also
thanks
arrow_forward
Solve correct please
arrow_forward
QUESTION 33
Use the schematic for our board to select the input signals on the I/O Memory selection hardware that are used to generate the ROMRD signal on our board.
WR
ROMSEL
O WR
10/M
O RD
O READY
O O
arrow_forward
Must be handwritten No AI based ANSWER
arrow_forward
Write a loop which fills all of data memory (0 to 255) with Use 8051 assembly language.
arrow_forward
1. Assume that the registers are 8-bit wide. Consider the following code:
MOV R1, #4A
MOV R2, #40
ADD R3, R1, R2
a) What will be the 8-bit result in Register R3 (in hex)?
b) What is the 8-bit result in Register R3 (as unsigned decimal)?
c) What is the 8-bit result in Register R3 (as signed decimal)?
d) What will be the value of the carry (C) bit?
arrow_forward
Let (BX)=100H, DI=200H, DS=1200H, SI=
FO02H, AX= 0105H, and the following
memory content. what is the content of SI
after executing the MOV SI, [DI+BX+7H]
instructions? *
Memory
Memory
address
content
12300
11
12301
AA
12302
EF
12303
80
12304
47
12305
8D
12306
5A
12307
92
12308
C5
SI = EF80H
SI = 80EFH
SI = 92C5H
SI = C592H
arrow_forward
New Solution
arrow_forward
QO
dddd
Q1
clock
Given:
• Counter starts at decimal 9 when Q viewed as a 4-bit unsigned number (Q3 most significant bit)
What is the decimal value of Q (viewed as a 4-bit unsigned number) after four more clock “ticks"? Answer
arrow_forward
Plz solve within 30min I vill give definitely upvote and vill give positive feedback thank you sir
arrow_forward
Digital Electronic
I need the answer in one hour please.
arrow_forward
Write a program to PUSH R0, R1, and R3 of Bank 0 onto the stack and POP them back into R5, R6, and R7 of Bank 3. Also, mention the value of SP register after every PUSH and POP operation.
this question is asked in microprocessor and microcontroller
arrow_forward
SEE MORE QUESTIONS
Recommended textbooks for you

Related Questions
- The numbers from 0-9 and a no characters is the Basic 1 digit seven segment display * .can show False True In a (CA) method of 7 segments, the anodes of all the LED segments are * "connected to the logic "O False True Some times may run out of pins on your Arduino board and need to not extend it * .with shift registers True Falsearrow_forwardPlease answer in typing formatarrow_forwardquestion1:In a memory system, data is 16-bit wide. Break the information into bytes with their addresses using little endian and big-endian methods. Starting address is F800 and the data is: E0F2 0041 question2:What acknowledgment signals are there in I2C bus?arrow_forward
- To select the ROM the address lines A10-A9 should be: A. 00 B. 01 C. 10 D.10arrow_forward6- Set BX to 4567H, CX to FEDCH and SP to A59FH, then run the instructions: PUSH BX PUSH CX a. What is the new value of SP ? b. Display the memory locations where you pushed the values of BX and CX in the stack.arrow_forwardQuestion in photo please ASAP Hand written also thanksarrow_forward
- Write a loop which fills all of data memory (0 to 255) with Use 8051 assembly language.arrow_forward1. Assume that the registers are 8-bit wide. Consider the following code: MOV R1, #4A MOV R2, #40 ADD R3, R1, R2 a) What will be the 8-bit result in Register R3 (in hex)? b) What is the 8-bit result in Register R3 (as unsigned decimal)? c) What is the 8-bit result in Register R3 (as signed decimal)? d) What will be the value of the carry (C) bit?arrow_forwardLet (BX)=100H, DI=200H, DS=1200H, SI= FO02H, AX= 0105H, and the following memory content. what is the content of SI after executing the MOV SI, [DI+BX+7H] instructions? * Memory Memory address content 12300 11 12301 AA 12302 EF 12303 80 12304 47 12305 8D 12306 5A 12307 92 12308 C5 SI = EF80H SI = 80EFH SI = 92C5H SI = C592Harrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
