coursework 4 microprocessor
TRANSCRIPT
-
7/28/2019 Coursework 4 Microprocessor
1/7
Aeronautical Telecommunication Engineering SchoolCANDIDATE ASSESSMENT
PROGRAMME: Post Graduate Diploma in Air Traffic SafetyElectronics Engineering.
PProg No: PGDATSEE1
Module Name: Microprocessor & Embedded System. Module No: ATE 613
Assessment Title Coursework 2: - (weighting: %)1. A) Write the 8086 Microprocessor instructions to carry out the following
operations:I. Complement the contents of the carry flag.II. Rotate the contents of the accumulator by one bit to the left
through carry.B) State the function of each of the following instructions:
I. JNZ DELAYII. CPL A, R2
C) State the difference between CMP and SUB instructionsD) The 8051 controller displays five advert pictures on an LCD display.
Each picture is displayed for a period of five seconds (delay) afterwhich the next picture will be displayed for another five seconds.Assume that the controller executes five instructions in onemicrosecond. Using general purpose registers, write the nested-loopcode to implement delay.
2. Interface external program memory with 8051 and briefly explain howdata is transferred.
3. Using 7-segment display modules, design an 8051 microcontroller-based display board to display HELLO. Write the program code thatwill enable the smooth display of the characters.
Students Name OYELOWO Samuel
Assessors Name Engr. Isa Danjuma.
Date Set: April 29, 2013 Submission Date: May 21, 2013 FeedbackDate:
Date
Received:
Referral Date:
ASSESSORS GENERAL COMMENTS:
Signature: Date:
GRADE/MARK:
INTERNAL VERIFIER DATE
SAMPLED BY IV DATE
1 Issue 1 11/01/13
-
7/28/2019 Coursework 4 Microprocessor
2/7
ASSESSMENT ` FEEDBACK FORM
Assessment Criteria Achieved Evidence Comments/FeedbackYes/No
Yes/No
Yes/No
Yes/No
Yes/No
Declarations:
I am aware of the Ethical and the Health & Safety issues concerned with the satisfactorycompletion of this coursework; and I have taken all relevant measures accordingly.
I hereby certify that this submission is entirely mine and that the Institution can penalise meunder the Plagiarism rule if found otherwise.
Signature: Oyelowo .S Date: 21th May 2013.
2 Issue 1 11/01/13
-
7/28/2019 Coursework 4 Microprocessor
3/7
COURSEWORK 2 ON MICROPROCESSORS & EMBEDDEDSYSTEMS
Submitted by
SAMUEL OYELOWO
PG/2013/0014
PGD AIR TRAFFIC SAFETY ELECTRONICS ENGINEERING (ATE SCHOOL)
COURSE INSTRUCTOR: ENGR. ISA DANJUMA
DATE: 21/05/2013.
Question 1:
3 Issue 1 11/01/13
-
7/28/2019 Coursework 4 Microprocessor
4/7
A. Write the 8086 Microprocessor instructions to carry out the following operations:I. Complement the contents of the carry flag.
II. Rotate the contents of the accumulator by one bit to the left through carry.
B. State the function of each of the following instructions:i. JNZ DELAY
ii. CPL A, R2
C. State the difference between CMP and SUB instructions.
D. The 8051 controller displays five advert pictures on an LCD display. Each picture is displayedfor a period of five seconds (delay) after which the next picture will be displayed for anotherfive seconds. Assume that the controller executes every instruction in 1 microsecond. Using thegeneral purpose registers, write the nested-loop code to implement delay.
Solution 1:
A.I. MOV AL, 72H ; AL = 72H = 0111 0010MOV BL, 41H ; BL = 41H = 0100 0001ADD AL, BL ; AL = AL + BL = 1011 0011; Carry Flag CF = SetCMC AL ; AL = 0011 0011; CF = Reset.
II. STC ; Set Carry (CF = 1)MOV AL, 1CH ; AL = 0001 1100RCL AL, 1 ; AL = 0011 1001
B.i. JNZ DELAY: This is a conditional jump instruction used when some conditions are in act.Used to transfer control to another point in a program for a short duration.
ii. CPL A, R2: This instruction complements the contents of register R2 to that of theaccumulator.
C. Difference between CMP and SUB instructions: They both subtract and set flags but CMPdoes not store result while SUB does.
D. Parameters Given:
Instruction execution time of microcontroller = 1s (microseconds)Each picture is displayed for 5-sec
If in 10-6sec All instruction is been executedThen, in 1sec 1,000,000 instructions will be executedTherefore, for a display of 5sec 5,000,000 instructions will be executed.
Since, maximum mask in a given byte = 255
Therefore, for the microcontroller to execute 5,000,000 instructions, it will require up to 3-general purpose registers. i.e.
Register R1; A = 200 instructionsRegister R2; B = 200 instructions
4 Issue 1 11/01/13
-
7/28/2019 Coursework 4 Microprocessor
5/7
Register R3; C = 125 instructions
Such that, A*B*C = 200*200*125 = 5,000,000 instructions
Nested-loop code given below:
MOV R1, AL3: MOV R2, BL2: MOV R3, CL1: DEC R3
JNZ L1DEC R2JNZ L2DEC R1JNZ L3
NOPEND
Solution 2:
External Program Memory (ROM-Read only Memory) interface with 8051 Microcontroller
In the diagram above, Port 0 and Port 2 provide 16-bit address to access external memory. P0
provides the lower 8 bit address A0 A7, and P2 provides the upper 8 bit address A8 A15.
P0 is also used to provide the 8-bit data bus D0 D7. P0.0 P0.7 are used for both the address anddata paths (address/data multiplexing).
ALE (address latch enable) pin is an output pin for 8051. When ALE = 0, P0 is used for data path and
when ALE = 1, P0 is used for address path. To extract address from P0 pins, P0 is connected to an
external latch and ALE signal is generated by 8051 which is then used to latch the address. Normally
when ALE = 0, P0 is used as a data bus, sending data out or bringing data in. However, whenever the
5 Issue 1 11/01/13
P1 P0
EA8051
ALE
P3 P2
PSEN
D0-D
7
ROMA
0-A
7
Address
A8-A
15
OE
LATCH(Clk)
-
7/28/2019 Coursework 4 Microprocessor
6/7
8051 wants to use P0 as an address bus, it will put the addresses A0 A7 on the P0 pins and activates
ALE = 1.
PSEN (Program Store Enable) signal is an output signal for the 8051 microcontroller and must be
connected to the OE (Output Enable) pin of a ROM containing the program code.
Whenever the EA pin is connected to GND (Ground), the 8051 fetches Opcode from external ROM
using the PSEN.
Solution 3: 5v
Note: Each connection to P1 has to be connected to a limiting resistor. P1 = Display SymbolEach connection to P2 will also be connected to a limiting resistor. P2 = Display Select.
Analysis for P1:
6 Issue 1 11/01/13
Symbol Mask Hex
a b c d e f g dp
H 1 0 0 1 0 0 0 1 91h
E 0 1 1 0 0 0 0 1 61h
L 1 1 1 0 0 0 1 1 E3hL 1 1 1 0 0 0 1 1 E3h
O 0 0 0 0 0 0 1 1 03h
8051
P2
P1
H E L L O
-
7/28/2019 Coursework 4 Microprocessor
7/7
Analysis for P2:
Program code to display characters:
AGAIN: IN P1, 00H ; this programs Port P1 as output port making all bits in the input = 0IN P2, 00H ; this also programs Port P2 as output making all bits in input = 0.OUT P1, 91HOUT P2, 16HSJMP DelayOUT P1, 61HOUT P2, 08HSJMP DelayOUT P1, E3HOUT P2, 04H
SJMP DelayOUT P1, E3HOUT P2, 02HSJMP DelayOUT P1, 03HOUT P2, 01HSJMP DelayJMP AGAIN
Reference(s)
Ayala, J.K., (1991), The 8051 microcontroller architecture, programming and applications.
Engr. Danjuma, I., (2013),Lecture note on microprocessors and embedded systems.
Mazidi, M.A. and Mazidi, J.G., (2009), The 8051 microcontroller and embedded systems. Departmentof computer science and information engineering, national cheng kung university, Taiwan.
Krishna, R. and Vishnu, V.N., (n.d), 8086 microprocessor instruction set.
Sedory, D.B., (n.d),Documentation for emu8086-assembler and microprocessor emulator.
7 Issue 1 11/01/13
7 6 5 4 3 2 1 0 Hex
0 0 0 0 0 0 0 0
0 0 0 1 0 0 0 0 16h
0 0 0 0 1 0 0 0 08h
0 0 0 0 0 1 0 0 04h0 0 0 0 0 0 1 0 02h
0 0 0 0 0 0 0 1 01h