Microprocessor Exam 1

advertisement
1.
Microprocessor Quiz 1
(15%) Convert the following hex numbers to binary and decimal.
(a) 2B9H
(b) F44H
(c) 912H
Ans:
(a) 0010 1011 1001b, 697
(b) 1111 0100 0100b, 3908
(c) 1001 0001 0010b, 2322
2.
(16%) Find the total amount of memory, in the units requested, for each of the
following CPUs, given the size of the address buses.
(a) 16-bit address bus (in K)
(b) 24-bit address bus (in megabytes)
(c) 32-bit address bus (in megabytes and gigabytes)
(d) 48-bit address bus (in megabytes, gigabytes, and terabytes)
Ans:
(a) 64K
(b) 16M
(c) 4096Mega, 4G
(d) 256 Tera, 262144 Giga, 268435456 Mega
3.
(8%) Answer the following questions:
(a) In a microcontroller with on-chip ROM, why does the size of ROM matter?
(b) In choosing a microcontroller, how important is it to have multiple sources
for that chip?
Ans:
(a) The ROM area is where the executable code is stored.
(b) Very, in case there is a shortage by one supplier.
4.
(10%) Find the CY flag value after each of the following code.
(a) MOV A, #54H
(b) MOV A, #250
ADD A, #0C4H
ADD A, #05
Ans:
(a) CY=1
(b) CY=0
5.
(12%) Answer the following questions:
(a) Show how you would check whether the OV flag is low.
(b) Show how you would check whether the AC flag is high.
(c) Show how you would check whether the P flag is high.
Ans:
(a) JNB PSW.2, ...
(b) JB PSW.6, …
(c) JB PSW.0, …
6.
7.
(10%) Answer the following questions:
(a) Registers R0-R7 are all
bits wide.
(b) Registers ACC and B are
bits wide.
(c) Name a 16-bit register in the 8051.
(d) The target address of a jump forward is a maximum of
the current PC.
(e) The target address of a jump backward is a maximum of
the current PC.
Ans:
(a) 8
(b) 8
(c) DPTR or PC
(d) 127
(e) 128
(10%) Generate a square wave with 75% duty cycle on bit P1.5.
HERE:
SETB
P1.5
LCALL DELAY
LCALL DELAY
LCALL DELAY
CLR
P1.5
LCALL DELAY
SJMP
8.
HERE
(9%) Show code for a nested loop to perform an action 100,000 times
MOV R6, #10
BACK: MOV R5, #100
AGAIN: MOV R4, #100
HERE:
DJNZ R4, HERE
DJNZ R5, AGAIN
bytes from
bytes from
DJNZ R6, BACK
9.
(10%) Write a program to add the following numbers and save the result in R2,
R3. The data is stored in on-chip ROM.
ORG 250H
MYDATA: DB
53, 94, 56, 92, 74, 65, 43, 23, 83
Ans:
NEXT1:
NEXT2:
HERE:
MYDATA:
ORG
MOV
MOV
MOV
MOV
CLR
MOVC
ADD
JNC
INC
MOV
INC
DJNZ
SJMP
ORG
DB
END
0000H
R3, #0
R2, #0
DPTR, #250H
R0, #9
A
A, @A+DPTR
A, R2
NEXT2
R3
R2,A
DPTR
R0, NEXT1
HERE
250H
53,94,56,92,74,65,43,23,83
Download