Professional Documents
Culture Documents
EEE342
Assignment # 01
Registration
Number FA20-BEE-033
Subject MP
b. How many times will ‘Loop1’ iterate before PC reaches NOP instruction in the end? Write
in a table, values of x1, y1 and temp for each iteration.
LDI x1, 5
LDI y1, 8
LDI
temp, 7
Loop1:
DEC y1
BREQ Out
CP y1, x1 // compare x1 y1
BRNE Loop1
LDI
temp,5
RJMP Loop1
Out:
NOP
First will run 3 times and then will run 5 time after RJMP. Total 8 times
Here values are saved and then decrement is used BREQ is used if Z=1 but will skip, then CP is
used for checking compare. BRNE is used if Z=0 if z= 0 then the loop will go back. If z=1 then
compare will be done and z=1 so it will skip BRNE. Rjump will move it back to loop1 and will
dec up 0
Table is given as
X1 Y1 Temp
5 8 7
5 7 7
5 6 7
5 5 7
Here Rjump is used and loop is started again.
5 4 5
5 3 5
5 2 5
5 1 5
5 0 5
Number = 0b00010000;
2.If DDRB = 0xBD; and PORTB = Your Roll No., Indicate the status of PortB pins such as (I)nput,
(O)utput or (P)ulled up.
DDRB=0b10111101
PORTB=0b00110011.
INPUT: all the zeros show input
OUTPUT: all the 1’S shows output
Pulled up: in port B where there is 1 it is pulled down and where there is zero then it will be
pulled up.
3.How big (in bits) a PC (Program Counter) is required to access a program memory of 1
MB x 8?
4.Why do ‘BRNE’ like branch statements take 2 clock cycles when they branch?
5.Which flags in the SREG will be set if following assembly commands are executed? The
effect of ‘inc’ command on SREG is shown as well.
Q3. State the contents of RAM locations 0x212 to 0x215 in a table after
the following program is executed:
(6)