=========================preview======================
(ELEC254)MiniExam04Spring.pdf
Back to ELEC254 Login to download
======================================================
The Hong Kong University of Science and Technology
Department of Electrical and Electronic Engineering
ELEC254 Mini Exam 19 March 2004
Name:
Student Number: (also fill in your student no. at the bottom of each page)
Time: 15:00-16:30 (1.5-hour open-book examination)
Do ALL the problems in this examination paper
Question Your Mark Mark of question
Q1 1
Q2 2
Q3 2
Q4 1
Q5 1
Q6 3
Total 10
Assume all LEDs are turned on and all the switches are opened initially, write a simple 8051 program such that only LED3 will be turned off when sw2 is closed.
ANS.: MOV A, P1 ANL A, #04H JZ SomeWhereElse MOV P2, #08H
Q2. Using the ASCII Table, write 80x86 instructions to display a character D on screen.
ANS.:
MOV AH, 02
MOV DL,D
INT 21H
Data bit: 9
Baud Rate: 19200 bps
Bi-directional data transfer
No multiprocessor communication feature
You can assume that the 8051 micro-controller is connected with a 11.0592MHz Crystal.
ANS.: MOV SCON, #11010000B ORL PCON, #10000000B MOV TMOD, #00100000B MOV TH1, # 0FDH SETB TR1
Q4. (a) Describe one major advantage of cache memory.
(b) Explain why there is a limited size of cache memory in any microprocessor.
ANS.:
(a)
zero wait time (or faster than embedded memory) (0.5 Mark)
(b)
State-of-art microprocessors have limited cache size due to bad yield and hence high production cost. (0.5 Mark)
Q5. A 8086 processor has to fully access the embedded RAM. The memory is constructed from several 256k4 SRAM. How many SRAM chip will be needed (Each address has a unit of byte)?
ANS.:
A processor 8086 has 20-bit address-bus width and 16-bit data-bus width. As a result, a total of
8 SRAM are needed.
P1.0 P1.1 P1.2 P1.3 P1.4 P1.5 P1.6 P1.7
P2.0 P2.1 P2.2
8051
P3.0 P3.1 P3.2 P3.3 P3.4 P3.5 P3.6 P3.7
D0
D1
D2 D3 D4 Floppy Disk Controller and
D5 D6 Drive
D7
INDEX SYNC READY TRACK 0 SENSOR
ENGAGE HEAD FORWARD/REVERSE READ ENABLE WRITE ENABLE DISC SELECT ENABLE CRC TEST BUSY LT
In the above diagram, the 8051 is used to interface a floppy disk controller. P1, P2 and P3 of the 8051 are used to connect to the pins as described. The arrow lines denote the direction of the data transfer. The function of each pin in the floppy disk controller is shown below:
SIGNAL FUNCTION Status 1 Status 0
D0 C D7 Data Bus
INDEX Get the Index of the Disk Ready Not Ready
SYNC READY To test if syncronization is ready Ready Not Ready
TRACK 0 SENSOR To check if the track 0 of the floppy is good Good Bad
ENGAGE HEAD Magnetic head movement signal Move Not Move
FORWARD/REVERSE Moving directions for motor Forward Reverse
READ ENABLE Read enable signal Enable Disable
WRITE ENABLE Write enable signal Enable Disable
DISC SELECT Select Disk/Memory Disk Memory
ENABLE CRC CRC Enable Signal Enable Disable
TEST Testing signal Testing Normal
BUSY LT Bu