You are on page 1of 16

Question 1.

A. State at least 2 advantages and 2 disadvantages of a microcontroller system over a hard


wired relay based or digital logic based system.
(see slide no. 13)
B. State at least 4 differences between a microcontroller and microprocessor. (see slide nos
37, 38, 40)
C. State at least one application when a microprocessor is best suitable and another
application when a microcontroller is best suitable.
(see slide no 42)

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

c- Indirect using registers R0 & R1:


MOV R0, #33H
MOV A, @R0

d- Indirect using Acc. A,


MOV A, #32H

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

COPY VALUE OF P0 TO ACC A

MOV B,

#04H

IMMEDIATE MOVE #04H TO B

MUL A,

MULTIPLY A TO B

MOV R0,

COPY A TO R0

MOV P1,

#0FFH

SET P1 AS INPUT

MOV A,

P1

COPY VALUE OF P1 TO ACC A

MOV B,

#05H

IMMEDIATE MOVE #04H TO B

10

MUL A,

MULTIPLY A TO B

11

SUBC A,

R0

SUBTRACT W/ CARRY ACC A TO 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.

With reference to the 8051 microcontroller, answer the following :

a) How many ports are available ?


4 ports
...........
b) Which port has pull-up resistors ?
P1-p3
...........
c) Which port you prefer to use as input and why ?

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

g) Why do we use ORG 0000H at the beginning of the program?


Start the program counter at 0000h
.

h) What is the address of the stack when 8051 is reset?


07h
...........

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

You might also like