Professional Documents
Culture Documents
Page 1 of 16
Page 2 of 16
Page 3 of 16
Question 2.
Sketch the internal RAM map of a typlical 8051 microcontroller showing the following :
Address range
Register banks
Bit/Byte addressable
General purpose area and addresses
(see slide no 74)
Page 4 of 16
Question 3.
Draw a typical block diagram of a computer system showing the following components :
CPU, RAM, ROM, I/Os, Address Bus, Data Bus and Control Bus.
(see slide no 23)
Describe each components briefly. (see slide nos 21, 24)
Page 5 of 16
Page 6 of 16
Page 7 of 16
Question 4.
Draw a typical block diagram of a microcontroller system showing the following components :
CPU, memory (RAM and EEPROM), I/O ports, programmable units (counter/timer, serial and
parallel I/O ports, A/D and D/A). ( see slide no. 49)
Page 8 of 16
Question 5.
Using the 8051 instruction list, give example for the following modes of addressing and explain
instruction outcome if executed :
a- Immediate :
MOV A, #33H
b- Direct:
MOV A, 33H
Page 9 of 16
Page 10 of 16
MOV R0, @A
Question 6
Write a short program to solve the following problem : Input 2 numbers x and y then output the
result of 5y 4x.
Write down all the steps in the program below.
Line
1
Opcode
ORG
Operand
0H
Comments
SET THE PROGRAM COUNTER TO 00H
MOV P0,
#0FFH
SET P0 AS INPUT
MOV A,
P0
MOV B,
#04H
MUL A,
MULTIPLY A TO B
MOV R0,
COPY A TO R0
MOV P1,
#0FFH
SET P1 AS INPUT
MOV A,
P1
MOV B,
#05H
10
MUL A,
MULTIPLY A TO B
11
SUBC A,
R0
12
MOV P2,
MOV A TO P2
13
END
Page 11 of 16
END OF PROGRAM
Question 7
Write a short program to solve the following problem : Input 2 numbers x and y then output the
result of 5y 3xy.
Write down all the steps in the program below.
Line
1
Opcode
or
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
Page 12 of 16
Operand
Comments
Question 8
Draw a flowchart to solve the following problems.
A large reception room uses a centralized air conditioning system. An IC sensor is used to
measure the room temperature. An inductive door limit sensor counts the number of people that enter
the room. The system uses on/off control to switch on the fan that blows cold air to the room.
There are 3 modes depending on how many people are in the house.
If there are more than 10 people in the room and the measured temperature is greater than
30C , it will turn on the fan.
If there are more than 5 people and less than 10 people in the room and the measured
temperature is greater than 25C, it will turn on the fan.
If the number of people is less than 5 and the temperature is greater than 22C, it will turn on
the fan.
Question 13.
Implement the algorithm below using the 8051 assembly code.
1.
2.
3.
4.
5.
6.
Input pressure
Compare pressure : is pressure greater than 50 psi ?
If pressure is greater than 50 psi turn off compressor
If yes, repeat step 1; if no proceed to step 5
Turn compressor on.
Repeat step 1.
Page 13 of 16
Question 9.
Read the following program and use the 8051 instruction list to identify the result
( value ) of every instruction. Write result beside each instructions.
.
COMMENTS
Page 14 of 16
MOV A,#FFH
; ____________________________________
MOV R0,#77H
; ____________________________________
ANL A,R0
; ____________________________________
MOV 15H,A
; ____________________________________
CPL
; ____________________________________
ORL 15H,#88H
; ____________________________________
ANL A,15H
; ____________________________________
ORL A,R0
; ____________________________________
CLR A
; ____________________________________
ADD A,#0Ch
; ____________________________________
MOV B,#03H
; ____________________________________
MUL AB
; _______________________________________
Question 10.
d) What hexadecimal value you output to a port to set as input, and why ?
ffh
...........
e) Where does the CPU store the "return address", when ACALL instruction is executed?
...........
f) Why do we need to write END at the end of your program?
To tell the compiler where the program will end
Page 15 of 16
i) What is the name of the register that contains the stack address?
Stack pointer
...........
j) What does PC is used for.
The program counter points to the address of next instruction to be executed
Page 16 of 16