Microprocessor Microcontroller EXAM 2021 MG
Microprocessor Microcontroller EXAM 2021 MG
Read the instructions carefully before you start answering the questions.
Instructions
o Answer all questions
o You are free to start by any section.
o This paper is divided in to two sections section A and section B
o Orderly presents your answers
o Respect all symbols tags for technical diagrams
CORRECTION
Section A: (25 marks)
MODULE 1: TRUE or FALSE ( 10 marks)
0 mark if no answer.
Questio 1 2 3 4 5 6 7 8 9 10
n
Answer
Answer
Question 1 2 3 4 5 6 7 8 9 10
Anwers T T F T F T T F T F
Page 2 / 11
D. None of the above
Answer
A special purpose register is one that has a specific control or data handling task to carry out.
There are a number of special purpose registers within the CPU. The diagram above shows
that the CPU contains a number of registers in order to process data and to follow program
instructions. Some specialist ones include
- Accumulator
- Stack pointer
- Flag registers
4. With example instruction, explain some three addressing modes supported by 8085
processor? (3 mks)
Answer
Immediate addressing mode
In this mode, the 8/16-bit data is specified in the instruction itself as one of its operands. For
example MVI E, ABH means ABH is copied into register A.
Register addressing mode
In this mode, the data is copied from one register to another. For example, MOV A, B: means
data in register B is copied to register A.
Direct addressing mode
In this mode, the data is directly copied from the given address to the register. For example
LDA 3000H: means the data at address 3000H is copied to register A.
Indirect addressing mode
Page 3 / 11
In this mode, the data is transferred from one register to another by using the address pointed
by the register. For example, MOV A, M: means data is transferred from the memory address
pointed by the register pair HL to the register A.
RISC CISC
RAM+ROM in single memory RAM and ROM in different memory
Low speed High speed
Less complexity More complexity
c. The microcontroller is driven by crystal clock circuit. Draw this circuit. How this
circuit process to synchronize the data. (3 marks)
Drawing of the circuit
To synchronize the data, the clock circuit provide the input frequency of the processor.
This frquency in divided into 4 inner the processor so that each important area shall be
have his own frequency to work. (3 marks)
d. Let consider the memory location i figure 1.
Page 4 / 11
Figure 1
d.1 How many bits of address is used for this memory! (1.5 marks)
The memory use 4 addresses bits.
d.2 find the number of possibility that this memory can used for the register. (1.5 marks)
The number of possibility is 24 = 16 possibilities.
d.3 Give the set of bits of data lines if the input address is 1001. (2 marks)
The set of data lines for address 1001: 00001001
We consider a single processor that drive the RAM memories with 16 adresses and 8 bits for
data lines for access at each memory cell. Each memory cell has a capacity of 64K. Figure 2
and Figure 3 show the appearance of a processor and a single RAM memory with the pins.
Figure 2 Figure 3
Page 5 / 11
The number of RAM memory cell is equal to the number of data pins driven by
microprocessor. We will used 8 RAM memory cells.
b) How the data are transferred (from address pins) until reach to the memory!
c) Draw the diagram that describe the arrangement of the microprocessor and these
RAM memories. (5 marks)
d) Explain exactly how the RAM memory cell is accessed. (1.5 marks)
Each cell memory is accessed using a data pins (from 0000000 to 11111111) of the
microprocessor. These pins are driven when new packet of data is present at the level of
address pins. And when memory cell is already used, a particular counter check other bit to
know whether memory cell is being used of not.
The whole memory is full when each RAM memory cell is used (from 0000000 to
11111111).
e) What is the total size (CT) of the Whole memory! (1.5 marks)
f) What can be the behavior of the memory if an additional data (from address pins)
arrived! (2 marks)
If we an additional data (from address pins) arrived, the memory can’t be able to store it.
Data will be rejected.
Page 6 / 11
g) We consider that a set of each data that will be stored in a RAM memory cell used the
half (1/2) of the memory cell. How many sets of data is possible to full the whole
memory! (2 marks)
The size of memory cell is 64K then the half is 32K. then to full a single cell we need 2
packets of data. Since we have 8 memories cells, then we will have 16 packets of data to
completely full the whole memory.
Answer
SW
X1 U1
16
OSC1/CLKIN RA0
17 R5
15 18 10k
OSC2/CLKOUT RA1
1
CRYSTAL (4MHz) RA2
4 2
MCLR RA3
C2 C1 RA4/T0CKI
3
22pF 1pF
6
RB0/INT
7
RB1
8
RB2
9
RB3
10
RB4
RB5
11 R9
12 220
RB6
13
RB7
PIC16F84A
R8 D8
LED-BIRG
10k
BSF STATUS,5
;;MOVLW 00H
;;MOVWF TRISB
CLRF TRISB ;; SET PORTB FOR OUTPUTS
Page 7 / 11
MOVLW 0X01
MOVWF TRISA ; SET ra0 AS IBPUT
BCF STATUS,5
CLRF PORTA
LOOP CLRF PORTB
MAIN BTFSS PORTA,0
GOTO LOOP
MOVLW 0X01
MOVWF PORTB
CALL ROUTINE
CLRF PORTB
CALL ROUTINE
GOTO MAIN
ROUTINE
; =======DELAY CODE
LOOP3 DECFSZ COUNT1,1
GOTO LOOP3
LOOP4 DECFSZ COUNT2,1
GOTO LOOP4
RETURN
END
Question Four (10 marks)
Consider the electronic circuit below designed on the PIC16F84A. The circuit is a seven-segment
display circuit which displays the numbers 0,1,2,3,4,5,6,7,8,9and repeat the sequence continuously
X1 U1
16 17
OSC1/CLKIN RA0
15 18
OSC2/CLKOUT RA1
1
RA2
4 2
CRYSTAL (4MHz) MCLR RA3
RA4/T0CKI
3
COMMON CATHODE 7 SEGMENT
C2 C1 R1
22pF 1pF 6
RB0/INT
7
RB1 220
8
RB2
9
R2
RB3
10
RB4 220
11
RB5
12
R3
RB6
13
RB7 220
PIC16F84A
R4
220
R5
R8
220
10k R6
RESET PIC (MASTER CLEAR) 220
R7
220
a) Explain the relevance of R1, R2, R3, R4 R5, R6, R7 and RESET PIC
Page 8 / 11
b) Develop an assembly language program that will implement this sequence of counts. The PIC is
operating at a frequency of 4MHz. The MCLR Button resets the PIC controller. You are obliged
to add comments to your code
c) Based on your program written in (a), calculate the total time of execution of the program
Answer
a) R1, R2, R3, R4 R5, R6, R7 limits the voltage the goes to power the LEDs in the 7-sement
and RESET PIC is used to reset all operation in the PIC
b) ======
;Project: Counting on 7-segment display
List P = 16F84
#include <p16F84.inc>
__CONFIG 1Bh ;_CP_OFF & _PWRTE_ON & _WDT_OFF & _RC_OSC
Page 11 / 11