Microprocessor Based Systems Lab Manualfinal
Microprocessor Based Systems Lab Manualfinal
LABORATORY MANUAL
Engr.Muhammad Khalid
STUDENT INFORMATION
Name: _______________________________________________________
Semester: ____________________________________________________
Program: __________________________________________________
List of Experiments
Lab Experiments Remarks Mapping
No.
1. Familiarization with the Organization and the Operating CLO1,
Procedures of the MDA-8086 Trainer PLO2-9
Using 8255A Chip to Interface LED with 8088 microprocessor CLO1,
2. using MDA-8086 Trainer PLO2-9
3. Using 8255A Chip to Interface 7 segment display with 8088 CLO1,
microprocessor using MDA-8086 Trainer PLO2-9
4. Using 8255A Chip to Interface Dot Matrix display with 8088 CLO1,
microprocessor using MDA-8086 Trainer PLO2-9
5. Interfacing Speaker with 8088 microprocessor using MDA-8086 CLO1,
Trainer PLO2-9
6. Interfacing Hex Keyboard with microprocessor using MDA-8086 CLO1,
Trainer PLO2-9
7. Interfacing and programming 16 × 2 Line LCD Module with 8088 CLO1,
microprocessor using MDA-8086 Trainer PLO2-9
8. (Open Ended LAB) CLO1,
PLO2-9
9. Interfacing and Driving Stepper Motor with 8088 microprocessor using CLO1,
MDA-8086 Trainer PLO2-9
10. Interfacing DAC0800 with 8088 microprocessor using MDA-8086 CLO1,
Trainer PLO2-9
11. Interfacing ADC-0804 with 8088 microprocessor using MDA- CLO1,
8086 Trainer PLO2-9
12. Write a program to control fringing angle of SCR to manage input voltage CLO1,
to a tungsten lamp using MDA-8086 Trainer PLO2-9
13. Write a program to control Elevator movement using MDA-8086 CLO1,
Trainer PLO2-9
14. Write a program in Assembly language given that if user press “1”
LEDs from 11 to 14 glow sequentially similarly when user press
CLO1,
“2” hex value of 0 to F should be display on 7-segment display
PLO2-9
while for any keyboard hit microprocessor will remain in no
operation mode.
15. Write a program in Assembly language given that if user presses
“1” “IQRA UNIVERITY” should be displayed on first line of
CLO1,
LCD similarly when user press “2” “KARACHI” should be
PLO2-9
display on second line of LCD while for any keyboard hit
microprocessor will remain in no operation mode.
16. (Open Ended LAB) CLO1,
PLO2-9
Exceeds Meets
Developing Unsatisfactory
Criteria Expectations Expectations
(50%-69%) (<50%)
(>=90%) (70%-89%)
Able to setup Able to setup
experiment experiment Can setup major
Can’t set up the
Experimental independently with independently part of the
experiment even
Setup complete with adequate experiment with
with assistance
understanding of understanding of assistance
each step each step
Able to follow
the procedure Able to follow
Able to follow
completely with major part of the Unable to follow
Procedure the procedure
simplification or procedure with the procedure
completely
develop alternate errors or omissions
procedure
Able to achieve
all the desired Able to achieve
Able to achieve
Experimental results with most of the Unable to achieve
all the desired
Results alternate ways to desired results the desired results
results
improve with errors
measurements
All sections of the
All sections of the All sections of the
report are very Few sections of
Laboratory report are report contain
well written and the report contain
Manual technically multiple technical
technically technical errors.
accurate. errors.
accurate.
Instructor:
Objectives:
The goals of the Microprocessor Systems laboratory are;
1. To allow the students to perform experiments that explain the assembly language programming and demonstrate the
working with emu8086.
2. To introduce the students to 8086 microprocessor and its essential circuitry.
3. To familiarize the students with interfacing of 8086 microprocessor with several I/O devices.
Contents:
Assembly language programming, emu8086, 8086 microprocessor and its essential circuitry, with interfacing of 8086
microprocessor with several I/O devices.
Learning Outcomes:
Grading Policy
Marks *GPA Grade
Greater than 88 4 A
Between 81 to 87 3.5 B+
Between 74 to 80 3 B
Between 67 to 73 2.5 C+
Between 60 to 66 2 C
Below 60 0 F
*GPA = Grade Point Average
Always pay attention to what you are doing and you’re surrounding during the experiments, notify the
Instructor for any unlikely event or mishap, and leave the Laboratory with the permission of Instructor
immediately.
All students must read and understand the information in this document with regard to laboratory safety and
emergency procedures prior to the first laboratory session.
Your personal laboratory safety depends mostly on YOU. Efforts have been made to address situations
that may pose a hazard in the lab but the information and instructions provided cannot be considered all-
inclusive.
Students must adhere to written and verbal safety instructions throughout the academic term. Since
additional instructions may be given at the beginning of laboratory sessions, it is important that all students
arrive at each session on time. With good judgment, the chance of an accident in this course is very small.
Nevertheless, research and teaching workplaces (labs, shops, etc.) are full of potential hazards that can cause
serious injury and or damage to the equipment. Working alone and unsupervised in laboratories is forbidden
if you are working with hazardous substances or equipment. With prior approval, at least two people should
be present so that one can shut down equipment and call for help in the event of an emergency. Safety
training and/or information should be provided by a faculty member, teaching assistant, lab safety contact,
or staff member at the beginning of a new assignment or when a new hazard is introduced into the
workplace.
Emergency Response
1. It is your responsibility to read safety and fire alarm posters and follow the instructions during an
emergency
2. Know the location of the fire extinguisher, eye wash, and safety shower in your lab and know how to
use them.
3. Notify your instructor immediately after any injury, fire or explosion, or spill.
4. Know the building evacuation procedures.
Common Sense
Good common sense is needed for safety in a laboratory. It is expected that each student will work in a
responsible manner and exercise good judgment and common sense. If at any time you are not sure how to
handle a particular situation, ask your Teaching Assistant or Instructor for advice DO NOT TOUCH
ANYTHING WITH WHICH YOU ARE NOT COMPLETELY FAMILIAR!!! It is always better to ask
questions than to risk harm to yourself or damage to the equipment.
Personal and General laboratory safety
1. Never eat, drink, or smoke while working in the laboratory.
2. Read labels carefully.
3. Do not use any equipment unless you are trained and approved as a user by your supervisor.
4. Wear safety glasses or face shields when working with hazardous materials and/or equipment.
5. Wear gloves when using any hazardous or toxic agent.
6. Clothing: When handling dangerous substances, wear gloves, laboratory coats, and safety shield or
glasses. Shorts and sandals should not be worn in the lab at any time. Shoes are required when working in
the machine shops.
7. If you have long hair or loose clothes, make sure it is tied back or confined.
8. Keep the work area clear of all materials except those needed for your work. Coats should be hung in the
hall or placed in a locker. Extra books, purses, etc. should be kept away from equipment that requires air
flow or ventilation to prevent overheating.
9. Disposal - Students are responsible for the proper disposal of used material if any in appropriate
containers.
10. Equipment Failure - If a piece of equipment fails while being used, report it immediately to your lab
assistant or tutor. Never try to fix the problem yourself because you could harm yourself and others.
11. If leaving a lab unattended, turn off all ignition sources and lock the doors.
12. Never pipette anything by mouth.
13. Clean up your work area before leaving.
14. Wash hands before leaving the lab and before eating.
15. Unauthorized person(s) shall not be allowed in a laboratory for any reason
Electrical safety
1. Obtain permission before operating any high voltage equipment.
2. Maintain an unobstructed access to all electrical panels.
3. Wiring or other electrical modifications must be referred to the Electronics Shop or the Building
Coordinator.
4. Avoid using extension cords whenever possible. If you must use one, obtain a heavy- duty one that is
electrically grounded, with its own fuse, and install it safely. Extension cords should not go under doors,
across aisles, be hung from the ceiling, or plugged into other extension cords.
5. Never, ever modify, attach or otherwise change any high voltage equipment.
6. Always make sure all capacitors are discharged (using a grounded cable with an insulating handle) before
touching high voltage leads or the "inside" of any equipment even after it has been turned off. Capacitors
can hold charge for many hours after the equipment has been turned off.
7. When you are adjusting any high voltage equipment or a laser which is powered with a high voltage
supply, USE ONLY ONE HAND. Your other hand is best placed in a pocket or behind your back. This
procedure eliminates the possibility of an accident where high voltage current flows up one arm, through
your chest, and down the other arm.
8. Discard damaged cords, cords that become hot, or cords with exposed wiring.
9. Before equipment is energized ensure, (1) circuit connections and layout have been checked by a
Teaching Assistant (TA) and (2) all colleagues in your group give their assent.
10. Know the correct handling, storage and disposal procedures for batteries, cells, capacitors, inductors and
other high energy-storage devices.
11. Experiments left unattended should be isolated from the power supplies. If for a special reason, it must
be left on, a barrier and a warning notice are required.
12. Equipment found to be faulty in any way should be reported to the Lab Engineer immediately and taken
out of service until inspected and declared safe.
13. Voltages above 50 V rms AC and 120 V DC are always dangerous. Extra precautions should be
considered as voltage levels are increased.
14. Never make any changes to circuits or mechanical layout without first isolating the circuit by switching
off and removing connections to power supplies.
15. Know what you must do in an emergency.
16. Emergency Power Off: Every lab is equipped with and Emergency Power Off System.
17. Only authorized personnel are permitted to reset power once the Emergency Power Off system has been
engaged.
Electrical Emergency Response
The following instructions provide guidelines for handling two types of electrical emergencies:
1. When someone suffers serious electrical shock, he or she may be knocked unconscious. If the victim is
still in contact with the electrical current, immediately turn off the electrical power source. If you cannot
disconnect the power source, depress the Emergency Power Off switch.
2. Do not touch a victim that is still in contact with a live power source; you could be electrocuted.
3. Have someone call for emergency medical assistance immediately. Administer first-aid, as appropriate.
4. If an electrical fire occurs, try to disconnect the electrical power source, if possible. If the fire is small and
you are not in immediate danger; and you have been properly trained in fighting fires, use the correct type
of fire extinguisher to extinguish the fire. When in doubt, push in the Emergency Power Off button.
5. NEVER use water to extinguish an electrical fire.
Mechanical safety
1. When using compressed air, use only approved nozzles and never direct the air towards any person.
EXPERIMENT # 1
Familiarization with the Organization and the Operating Procedures of the
MDA-8086 Trainer
Name: _______________________________________________________
Registration No._______________________________________________
Program: _________________________________________________
Remarks :
_____________________________________________________________
_____________________________________________________________
_____________________________________________________________
____________________
Lab Instructor Signature
Objective:
Familiarization with the Organization and the Operating Procedures of the MDA-8086 Trainer
In this task you will be locating and getting familiar with the following functional units of the MDA-8086
trainer. These units are considered as the Building Blocks of a microprocessor based system.
i. 8086 Microprocessor
ii. RAM (Random Access Read and Write Memory)
iii. EPROM (Ultraviolet Erasable and Electrically Programmable Random Access Read Only Memory)
iv. Input Device (The Keyboard)
v. Keyboard Interface Controller
vi. Output Devices:
Procedures:
1. Look at the PCB (Printed Circuit Board) of the trainer and the component layout of Figure-1.
2. Now, on the PCB, locate the circuit designation U1. This is the 8086 microprocessor chip.
3. Look very carefully on the top of the U1-chip and you will find the inscription ‘8086’.
4. Locate the keyboard on the trainer.
5. Locate the following output devices on the PCB of the trainer.
a) The LCD unit. The interface controller of the LCD device is built-in within the LCD panel.
b) The 7-segment display device, which has the circuit designation. This is a common-anode
type display device. Let us agree to call it by the symbolic name CA7SD (Common Anode 7-
Segment Display Device). A CA-type display device is opposite to CC-type display device.
The interface controller for this device is the chip, U29 (8255).
c) The LED assembly, LED11-LED13. The interface controller for these LEDs is the chip, U29.
6. Locate the RAM chips U9, U10 on the PCB. Bit capacity of each RAM is: 32x1024x8.
7. Locate the EPROM chips U7 and U8 on the PCB. These chips contain the Monitor Program of the
MDA-8086 trainer. Bit capacity of each EPROM is: 32x1024x8.
The following hardware block diagram of Figure-1 contains the total I/O scenario of the trainer.
Function of Keys:
MDA-8086 has high performance 64K-byte monitor program. It is designed for easy function. After power
is on, the monitor begins to work. In addition to all the key function the monitor has a memory
checking routine.
Figure 2
So as to use serial monitor, move switch P1 which located on the PCB like
Whenever RES is pressed, the display becomes FIGURE 2 and user can operate keyboard only in this
situation.
Serial Monitor
Serial monitor is the basic monitor program to do data communicate between MDA-8086 and computer.
Connecting MDA-8086 to PC:
8. Open COMM software. Connect extended cord of MDA-8086 with PC’s serial port. Press RES
button. Make sure the module is set in serial monitor mode.
9. Write your Code in notepad file and perform operations up to hex file creation.
10. Open another command prompt file.
11. Type LOD186 and press Enter.
12. Go to Comm window and press L. Press Enter. Select desired ABS file from up folder.
13. Type G 0000:1000 and press Enter.
Name:___________________________________________________
Registration No.___________________________________________
Program: ______________________________________________
Remarks :
_________________________________________________________
_________________________________________________________
_________________________________________________________
____________________
Lab Instructor Signature
Objective:
Using 8255A Chip to Interface LED with 8088 microprocessor using MDA-8086 Trainer
Interface Diagram:
Sample Program:
Sequentially ON (LED 11 to 14), then (LED 14 to 11) and perform this operation continuously.
CODE SEGMENT
ASSUME CS:CODE,DS:CODE,ES:CODE,SS:CODE
;LED PROGRAM
CW EQU 1FH
PORTC EQU 1DH
PORTB EQU 1BH
PORTA EQU 19H
ORG 1000H
MOV AL,80H
OUT CW,AL
L5: MOV AL,00000001B
L2: OUT PORTB,AL
CALL TIMER
SHL AL,1
TEST AL,00010000B
JNZ L3
JMP L2
TIMER: PUSH CX
MOV CX,0
N: NOP
NOP
LOOP N
POP CX
RET
CODE ENDS
END
Exercises:
Exercise 2.1: Write a program to sequentially turn ON four LED’s placed on trainer with 1 sec interval.
Exercise 2.2: Modify your program to limit the sequence for 5 times.
EXPERIMENT # 3
Using 8255A Chip to Interface 7-segment displays with 8088 microprocessor using
MDA-8086 Trainer
Name:___________________________________________________
Registration No.___________________________________________
Program: ______________________________________________
Remarks:
_________________________________________________________
________________________________________________________________
__________________________________________________
____________________
Lab Instructor Signature
Objective:
Using 8255A Chip to Interface 7- segment display with 8088 microprocessor using MDA-8086 Trainer
Interface Diagram:
Sample Program
CODE SEGMENT
ASSUME CS:CODE; DS:CODE; ES:CODE; SS:CODE
CW EQU 1FH
PORTC EQU 1DH
PORTB EQU 1BH
PORTA EQU 19H
ORG 1000H
MOV AL,80H
OUT CW,AL
BACK: MOV CX,4
MOV BX,OFFSET REG
L1: MOV AL,[BX]
OUT PORTA,AL
CALL TIMER
INC BX
LOOP L1
JMP BACK
TIMER:PUSH CX
MOV CX,1
TIMER2: PUSH CX
MOV CX,0
TIMER1: NOP
NOP
NOP
LOOP TIMER1
POP CX
LOOP TIMER2
POP CX
RET
REG: DB 099H
DB 092H
DB 0F9H
DB 0C0H
CODE ENDS
END
Exercises:
Exercise 3.1: Write a program to Sequentially display Hex digits “0” to ” F” on seven segment display such
that each digits remains on display 1 sec.
Exercise 3.2: Re-write program of exercise 3.1 so that seven segment encoded is implemented using look
up table.
EXPERIMENT # 4
Using 8255A Chip to Interface Dot Matrix display with 8088 microprocessor using
MDA-8086 Trainer
Name:_______________________________________________________
Registration No._______________________________________________
Program: __________________________________________________
Remarks :
_____________________________________________________________
_____________________________________________________________
_____________________________________________________________
____________________
Lab Instructor Signature
Object
Using 8255A Chip to Interface Dot Matrix display with 8088 microprocessor using MDA-8086 Trainer
General Description
The KMD D1288C is 1.26 inch height 3mm diameter and 8 × 8 dot matrix LED displays. The
KMD D1288C are dual emitting color type of red, green chips are contained in a dot with
milky and white lens color.
Dot-Matrix LED Interface Diagram
Sample Program
Sequentially ON, the whole line of Dot Matrix from Up to Down and perform this operation
continuously.
CODE SEGMENT
ASSUME CS:CODE; DS:CODE; ES:CODE;
SS:CODE
CW EQU 1EH
PORTC EQU 1CH
PORTB EQU 1AH
PORTA EQU 18H
ORG 1000H
MOV AL,80H
OUT CW,AL
MOV AL,0FFH
OUT PORTC,AL
MOV AL,0FFH
OUT PORTB,AL
MOV AL,7FH
BACK: OUT PORTA,AL
CALL TIMER
ROR AL,1
JMP BACK
TIMER: PUSH CX
MOV CX,1
TIMER2: PUSH CX
MOV CX,0
TIMER1: NOP
NOP
NOP
LOOP TIMER1
POP CX
LOOP TIMER2
POP CX
RET
CODE ENDS
END
Exercises:
Exercise 4.1: Sequentially ON, the whole line of Dot Matrix from Down to Up and perform this operation
5 times.
Exercise 4.2: Put on the diagonal LEDs.
Exercise 4.3: Display “X” on Dot Matrix.
EXPERIMENT # 5
Name:_______________________________________________________
Registration No._______________________________________________
Program: __________________________________________________
Remarks :
_____________________________________________________________
_____________________________________________________________
_____________________________________________________________
____________________
Lab Instructor Signature
Object
Sample Program
CODE SEGMENT
ASSUME
CS:CODE,DS:CODE,ES:CODE,SS:CODE
TIMER: PUSH CX
MOV CX,100
N: NOP
NOP
LOOP N
POP CX
RET
CODE ENDS
END
Exercises:
Name:_______________________________________________________
Registration No._______________________________________________
Program: __________________________________________________
Remarks :
_____________________________________________________________
_____________________________________________________________
_____________________________________________________________
____________________
Lab Instructor Signature
Object
General Description
Position Code
Key 0 1 2 3 4 5 6 7
Code 00 01 02 03 04 05 06 07
Key 8 9 A B C D E F
Code 08 09 0A 0B 0C 0D 0E 0F
Key : STP GO REG - + DA AD
Code 10 11 12 13 14 15 16 17
Sample Program
CODE SEGMENT
ASSUME CS:CODE; DS:CODE; ES:CODE; SS:CODE
CW EQU 1FH
PORTC EQU 1DH
PORTB EQU 1BH
PORTA EQU 19H
KEY EQU 01H
ORG 1000H
MOV AL,80H
OUT CW,AL
BACK: MOV AL,0FFH
OUT PORTA,AL
CALL SCAN
MOV AL,99H
OUT PORTA,AL
CALL TIMER
MOV AL,92H
OUT PORTA,AL
CALL TIMER
MOV AL,0F9H
OUT PORTA,AL
CALL TIMER
MOV AL,0C0H
OUT PORTA,AL
CALL TIMER
JMP BACK
SCAN: IN AL,KEY
TEST AL,10000000B
JNZ SCAN
AND AL,00011111B
OUT KEY,AL
RET
TIMER: PUSH CX
MOV CX,1
TIMER2: PUSH CX
MOV CX,0
TIMER1: NOP
NOP
NOP
LOOP TIMER1
POP CX
LOOP TIMER2
POP CX
RET
CODE ENDS
END
Exercises:
Exercise 6.1: Write a program so that when Key ‘4’, ‘5’, ‘1’, ‘0’, is pressed the corresponding number is
displayed on seven segment.
Exercise 6.2: Write a program so that when Key ‘1’ is pressed 7-segment sequentially displays Hex Digits
from 0 to F.
EXPERIMENT # 7
Name:_______________________________________________________
Registration No._______________________________________________
Program: __________________________________________________
Remarks:
_____________________________________________________________
_____________________________________________________________
_____________________________________________________________
____________________
Lab Instructor Signature
Object
Interfacing and programming 16 × 2 Line LCD Module with 8088 microprocessor using MDA-8086 Trainer
1) Physical Data
2) Pin Connections
3) Instruction
4) Initialization Sequence
Function Set
0 0 1 DL N F * *
DL = 1; 8-BIT
= 0; 4-BIT
N = 1; 2- Lines
= 0; 1- Line
Size:
F = 1; 5-10 Dots
= 0; 5*7 Dots
0 0 1 1 1 0 0 0
Display ON/OFF Control
0 0 0 0 1 D C B
D = Display ON/OFF
C= Cursor ON/OFF
B= Cursor Blink/Not
0 0 0 0 1 1 1 0
0 0 0 0 0 1 I/D S
I/D = 1 : Increment
Cursor
Move.
0: Decrement
0 0 0 0 0 1 1 1
Clear Display
0 0 0 0 0 0 0 1
D7 D6 D5 D4 D3 D2 D1 D0
1 ADD DATA
1 0 0 0 0 0 0 0
Read Busy Flag and Add
BF AC
BF = 0 : Not Busy
1: Busy
1 X X X X X X X X X
Sample Program
TIMER:
MOV CX,2
TIMER1:
PUSH CX
MOV CX,0
TIMER2:
NOP
NOP
NOP
NOP
LOOP TIMER2
POP CX
LOOP TIMER1
RET
NAMESTR:
DB 'IQRA UNIVERSITY',00H
CODE ENDS
END
Exercise 7.1: Write a program to display string “IQRA UNIVERSITY” on 2nd line of LCD.
Exercise 7.2: Write a program so that LCD displays the Key Number when pressed.
EXPERIMENT # 8
Name:___________________________________________________
Registration No.___________________________________________
Program: ______________________________________________
Remarks:
_________________________________________________________
_________________________________________________________
_________________________________________________________
____________________
Lab Instructor Signature
Objective:_______________________________________________________________
________________________________________________________________________
________________________________________________________________________
____________________________________________
Experimental Setup:
_______________________________________________________________________
_______________________________________________________________________
_______________________________________________________________________
_______________________________________________________________________
_______________________________________________________________________
_______________________________________________________________________
______________________________________________________________
Procedure:
_______________________________________________________________________
_______________________________________________________________________
_______________________________________________________________________
_______________________________________________________________________
_______________________________________________________________________
_______________________________________________________________________
_______________________________________________________________________
_______________________________________________________________________
_______________________________________________________________________
_______________________________________________________________________
______________________
Experimental Results:
_______________________________________________________________________
_______________________________________________________________________
_______________________________________________________________________
_______________________________________________________________________
_______________________________________________________________________
_______________________________________________________________________
_______________________________________________________________________
_______________________________________________________________________
_______________________________________________________________________
_______________________________________________________________________
__________________________________________________________
EXPERIMENT # 9
Name:___________________________________________________
Registration No.___________________________________________
Program: ______________________________________________
Remarks:
_________________________________________________________
_________________________________________________________
_________________________________________________________
____________________
Lab Instructor Signature
Object
Interfacing and Driving Stepper Motor with 8088 microprocessor using MDA-8086 Trainer
Stepping motors are suitable for translating digital inputs into mechanical motion. In general, there are three
types of stepping motor:
Figure 9-1 is used to explain the operation of simplified stepping motor (90°/step). Here the A coil
and B coil are perpendicular to each other. If either A or B coil is excited( a condition which is
known as single-phase excitation), the rotor can be moved to 0°, 90°, 180°, 270°degree position
depending on the current's ON/OFF conditions in the coils, see FIGURE 10-1(a). If both coils have
current flowing at the same time, then the rotor positions can be 45°, 135°, 225°, 315°degrees as
shown in FIGURE 10-1(b). This is known as two-phase exception. In FIGURE 10-1(c), the excitation
alternates between 1-phase and 2-phase, then the motor will rotates according to 0°, 45°, 90°, 135°,
180°, 225°, 270°, 315°sequence. This is 1-2 phase excitation, each step distance is only half of step
movement of either 1-phase or 2-phase excitation.
Stepping motor can rotate in clockwise or counter-clockwise direction depending on the current
pulse sequence applied to the excitation coils of the motor. Referring to the truth tables in FIGURE
10-1(a), (b), (c). If signals are applied to coil A and B according to Step 1,2,3,4,5,6,7,8, then counter-
clockwise movement is achieved. And vice-versa is true. If signals are applied according to step
8,7,6,5,4,3,2,1, then clockwise movement is achieved.
Commercial stepping motor uses multi-motor rotor, the rotor features two bearlike PM cylinders
that are turned one-half of tooth spacing. One gear is south pole, the other gear is north pole. If a 50-tooth
rotor gear is used, the following movement sequences will proceed.
Single-phase excitation:
The stepping position will be 0°,1.8°, 3.6°, ....... 358.2°, total 200 steps in one round.
Two-phase excitation:
The stepping positions will be 0.9°, 2.7°, 4.5°, ..... 359.1°, total 200 steps in one round.
The stepping positions will be 0°, 0.9°, 1.8°, 2.7°, 3.6°, 4.5°, ...............
358.2°, 359.1°, total 400 steps in one round.
CODE SEGMENT
ASSUME CS:CODE; DS:CODE; ES:CODE; SS:CODE
CW EQU 1FH
PORTC EQU 1DH
PORTB EQU 1BH
PORTA EQU 19H
KEY EQU 01H
ORG 1000H
MOV AL,80H
OUT CW,AL
BACK: CALL SCAN
MOV AL,10011001B
MOV CX,200
B1: OUT PORTB,AL
CALL TIMER
ROR AL,1
LOOP B1
JMP BACK
SCAN: IN AL,KEY
TEST AL,10000000B
JNZ SCAN
AND AL,00011111B
OUT KEY,AL
RET
TIMER: PUSH CX
MOV CX,3FFFH
N: NOP
NOP
LOOP N
POP CX
RET
CODE ENDS
END
Exercises:
Exercise 9.1: Write a program so that when any key is pressed, motor rotates 1 cycle CW.
Exercise 9.2: Write a program to drive motor CCW at the speed of 10 rpm.
EXPERIMENT # 10
Name:_______________________________________________________
Registration No._______________________________________________
Program: __________________________________________________
Remarks :
_____________________________________________________________
_____________________________________________________________
_____________________________________________________________
____________________
Lab Instructor Signature
Object
The DAC08 is a monolithic 8-Bit high-speed current output digital to analog converter (DAC)
featuring typical setting times of 100ns. When used as a multiplying DAC monotonic
performance over a 40 to 1 reference current range is possible. The DAC08 also features high
compliance complementary current outputs to allow differential output voltage of 20 Vpp with
simple resistor loads as shown in FIGURE 8-1.
CW EQU 1FH
PORTC EQU 1DH
PORTB EQU 1BH
PORTA EQU 19H
;LEVEL METER DOWN TO UP.
ORG 1000H
MOV AL,80H
OUT CW,AL
BACK: MOV AL,00H
B1: OUT PORTC,AL
CALL TIMER
INC AL
CMP AL,64H
JNE B1
JMP BACK
TIMER: PUSH CX
MOV CX,7FFFH
N: NOP
NOP
LOOP N
POP CX
RET
CODE ENDS
END
Exercises:
Name:_______________________________________________________
Registration No._______________________________________________
Program: __________________________________________________
Remarks :
_____________________________________________________________
_____________________________________________________________
_____________________________________________________________
____________________
Lab Instructor Signature
Object
General Description
The ADC0800 is an 8-bit monolithic A/D converter using P-channel ion-implanted MOS
technology. It contains a high input impedance comparator 256 series resistors and analog switches
control logic and output latches. Conversion is performed using a successive approximation
technique where the unknown analog voltage is compared to the resister tie points using analog
switches. When the appropriate tie point voltage matches the unknown voltage, conversion is
complete and the digital outputs contain an 8-bit complementary binary word corresponding to the
unknown. The binary output is TRI-STATE to permit bussing on common data lines.
A/D Converter Interface Diagram
Sample Program
Observe ADC value change on Level meter Led bar.
CODE SEGMENT
ASSUME CS:CODE; DS:CODE; ES:CODE; SS:CODE
CW EQU 1FH
PORTC EQU 1DH
PORTB EQU 1BH
PORTA EQU 19H
ADC EQU 18H
;ADC ANALOG VALUE AT LEVEL METER LEDS
ORG 1000H
MOV AL,80H
OUT CW,AL
BACK: MOV AL,00H
OUT ADC,AL
CALL TIMER
IN AL,ADC
OUT PORTC,AL
JMP BACK
TIMER:
MOV CX,3FFFH
TIMER1:
NOP
NOP
NOP
NOP
LOOP TIMER1
RET
CODE ENDS
END
EXPERIMENT # 12
Write a program to control fringing angle of SCR to manage input voltage to a tungsten lamp
using MDA-8086 Trainer
Name:___________________________________________________
Registration No.___________________________________________
Program: ______________________________________________
Remarks:
_________________________________________________________
_________________________________________________________
_________________________________________________________
____________________
Lab Instructor Signature
Object
Write a program to control fringing angle of SCR to manage input voltage to a tungsten lamp using MDA-8086 Trainer
Sample Program
Generate fix bulb intensity (less than full)
CODE SEGMENT
ASSUME CS:CODE, DS:CODE, ES:CODE, SS:CODE
PPI EQU 26H
CPORT EQU 24H
BPORT EQU 22H
APORT EQU 20H
;FIX BULB INTENSITY DEPEND ON TIMER 1-15
ORG 1000H
MOV AL,98H
OUT PPI,AL
MOV AL,0FFH
OUT CPORT,AL
BACK1: IN AL,CPORT
TEST AL,00010000B
JNZ BACK1
MOV AL,00H
OUT CPORT,AL
CALL TIMER
MOV AL,0FFH
OUT CPORT,AL
JMP BACK1
TIMER: MOV CX,10
DL2: PUSH CX
MOV CX,88H
DL1: LOOP DL1
POP CX
LOOP DL2
RET
CODE ENDS
END
Exercises:
Name:___________________________________________________
Registration No.___________________________________________
Program: ______________________________________________
Remarks:
_________________________________________________________
_________________________________________________________
_________________________________________________________
____________________
Lab Instructor Signature
Object
CW 26H
PORTC 24H
PORTB 22H
PORTA 20H
4F sensor PA7
3F sensor PA6
2F sensor PA5
1F sensor PA4
CODE SEGMENT
ASSUME CS:CODE,DS:CODE,ES:CODE,SS:CODE
CW EQU 26H
PORTC EQU 24H
PORTB EQU 22H
PORTA EQU 20H
;LIFT UP TILL 3FLOOR
ORG 1000H
MOV AL,90H
OUT CW,AL
MOV AL,00000010B
OUT PORTC,AL
L1: IN AL,PORTA
TEST AL,01000000B
JZ L1
MOV AL,00000011B
OUT PORTC,AL
BACK: JMP BACK
CODE ENDS
END
Exercises:
Exercises 13.1: Write a program to move elevator to 4th floor when its placed at 1st floor.
Exercises 13.2: Re-write the program in exercises 12.1 so that elevator moves from 1st floor to 4th floor
when key ‘4’ is pressed and than the elevator moves to 3rd floor when key ‘3’ is pressed.
EXPERIMENT # 14
Write a code in Assembly language given that if user press “1” leds from 11 to 14 glow sequentially
similarly when user press “2” hex value of 0 to F should be display on 7-segment display while for any
keyboard hit microprocessor will remain in no operation mode.
Name:___________________________________________________
Registration No.___________________________________________
Program: ______________________________________________
Remarks:
_________________________________________________________
_________________________________________________________
_________________________________________________________
__________________
Lab Instructor Signature
Object
Write a code in Assembly language given that if user press “1” leds from 11 to 14 glow sequentially
similarly when user press “2” hex value of 0 to F should be display on 7-segment display while for any
keyboard hit microprocessor will remain in no operation mode.
Sample Program
CODE SEGMENT
ASSUME CS:CODE,DS:CODE,ES:CODE,SS:CODE
CW EQU 1FH
PORTC EQU 1DH
PORTB EQU 1BH
PORTA EQU 19H
KEY EQU 01H
ORG 1000H
MOV AL,80H
OUT CW,AL
BACK: MOV AL,0FFH
OUT PORTA,AL
CALL SCAN
CMP AL,01H
JNE L1
JMP LED
L1: CMP AL,02H
JNE L2
JMP SEGG
L2: JMP BACK
TIMER: PUSH CX
MOV CX,1
TIMER2: PUSH CX
MOV CX,0
TIMER1: NOP
NOP
NOP
LOOP TIMER1
POP CX
LOOP TIMER2
POP CX
RET
SCAN: IN AL,KEY
TEST AL,10000000B
JNZ SCAN
AND AL,00011111B
OUT KEY,AL
RET
CODE ENDS
END
Exercises:
Write a code in Assembly language given that if user press “1” leds from 14 to 11 glow sequentially
similarly when user press “2” hex value of F to 0 should be display on 7-segment display while for any
keyboard hit microprocessor will remain in no operation mode.
EXPERIMENT # 15
Write a code in Assembly language given that if user presses “1” “IQRA UNIVERITY” should be
displayed on first line of LCD similarly when user press “2” “KARACHI” should be display on
second line of LCD while for any keyboard hit microprocessor will remain in no operation mode.
(Open Ended LAB)
Name:___________________________________________________
Registration No.___________________________________________
Program: ______________________________________________
Remarks:
_________________________________________________________
_________________________________________________________
_________________________________________________________
___________________
Lab Instructor Signature
Object
Write a code in Assembly language given that if user presses “1” “IQRA UNIVERITY” should be displayed
on first line of LCD similarly when user press “2” “KARACHI” should be display on second line of LCD
while for any keyboard hit microprocessor will remain in no operation mode.
Sample Program
CODE SEGMENT
ASSUME CS:CODE,DS:CODE,ES:CODE,SS:CODE
ORG 1000H
START:
CALL TIMER
CALL INITLCD
BACK: CALL SCAN
CMP AL,01H
JNE L1
MOV AL,01H
CALL CMDWR
MOV SI,OFFSET NAMESTR1
MOV AL,80H
CALL CMDWR
CALL DSPSTR
JMP BACK
CHKBSY:
PUSH AX
CHKBSY1:
IN AL,IRRD
AND AL,80H
JNZ CHKBSY1
POP AX
RET
CMDWR:
CALL CHKBSY
OUT IRWR,AL
RET
CHARWR:
CALL CHKBSY
OUT DTWR,AL
RET
INITLCD:
PUSH AX
MOV AL,38H
CALL CMDWR
MOV AL,0EH
CALL CMDWR
MOV AL,06H;
CALL CMDWR
MOV AL,01H
CALL CMDWR
POP AX
RET
DSPSTR:
DSPSTR1:
RET
TIMER:
MOV CX,2
TIMER1:
PUSH CX
MOV CX,0
TIMER2:
NOP
NOP
NOP
NOP
LOOP TIMER2
POP CX
LOOP TIMER1
RET
NAMESTR1:
DB 'IQRA UNIVERSITY',00H
NAMESTR2:
DB 'MAIN CAMPUS',00H
SCAN: IN AL,KEY
TEST AL,10000000B
JNZ SCAN
AND AL,00011111B
OUT KEY,AL
RET
CODE ENDS
END
Exercise 15
Write a code in Assembly language given that if user presses “1” “IQRA UNIVERITY” should be displayed
as blinking text on first line of LCD similarly when user press “2” “KARACHI” should be display as
blinking text on second line of LCD while for any keyboard hit microprocessor will remain in no operation
mode.
EXPERIMENT # 16
Name:___________________________________________________
Registration No.___________________________________________
Program: ______________________________________________
Remarks:
_________________________________________________________
_________________________________________________________
_________________________________________________________
____________________
Lab Instructor Signature
Objective:_______________________________________________________________
________________________________________________________________________
________________________________________________________________________
____________________________________________
Experimental Setup:
_______________________________________________________________________
_______________________________________________________________________
_______________________________________________________________________
_______________________________________________________________________
_______________________________________________________________________
_______________________________________________________________________
______________________________________________________________
Procedure:
_______________________________________________________________________
_______________________________________________________________________
_______________________________________________________________________
_______________________________________________________________________
_______________________________________________________________________
_______________________________________________________________________
_______________________________________________________________________
_______________________________________________________________________
_______________________________________________________________________
_______________________________________________________________________
______________________
Experimental Results:
_______________________________________________________________________
_______________________________________________________________________
_______________________________________________________________________
_______________________________________________________________________
_______________________________________________________________________
_______________________________________________________________________
_______________________________________________________________________
_______________________________________________________________________
_______________________________________________________________________
_______________________________________________________________________
__________________________________________________________
Appendix
MDA-8086 Memory Circuit
Mda-8086 Connector Circuit
(a) 8086
(b) 8088
8086 Instruction Set Summary
8086
REGISTER MODEL
mod Displacement
00 DISP : 0". disp-low and disp-high are absent
01 DISP : disp-low sign-extended to 16-bits. disp-high is absent
10 DISP = disp-high ; disp-low
11 r/w is treated as a "reg" field
00000H~0FFFFH RAM
11H Speaker
c) Intel Microprocessors 8086 8088, 80186 80188, 80286, 80386, 80486, Pentium, and Pentium Pro Proc: Architecture,
Programming and Interfacing 4th Edition by Barry B Brey