MPMC Student Lab Manual
MPMC Student Lab Manual
MPMC Student Lab Manual
DEPARTMENT OF
ELECTRONICS & COMMUNICATOIN ENGINEERING
2015-2016
INCHARGE HOD
(M.Laxmi) (Dr.P.Srihari)
1|Page
Geethanjali College Of Engineering And Technoly,Cheeryal
Microprocessors and Microcontrollers lab Dept of ECE
GCET 2|Page
Microprocessors and Microcontrollers lab Dept of ECE
1) Name : 1) Name :
2) Sign : 2) Sign :
3) Desg : 3) Desg :
4) Date : 4) Date :
Approved by : (HOD )
1) Name : Dr.P.Srihari
2) Sign :
3) Date :
GCET 3|Page
Microprocessors and Microcontrollers lab Dept of ECE
List of Experiments
The following programs/experiments are written for assembler and execute the
same with8086 and 8051 kits
1. Programs for 16 bit arithmetic operations for 8086 (using various addressing
modes)
2. Program for sorting an array for 8086
3. Program for searching for a number or character in a string for 8086
4. Program for String manipulations for 8086
5. Program for digital clock design using 8086.
6. Interfacing ADC and DAC to 8086.
7. Parallel communication between two microprocessors using 8255.
8. Serial communication between two microprocessor kits using 8251.
9. Interfacing to 8086 and programming to control stepper motor.
10. Programming using arithmetic, logical and bit manipulation instructions of 8051
11. Program and verify Timer/Counter in 8051.
12. Program and verify interrupt handling in 8051.
13. UART operation in 8051.
14. Communication between 8051 kit and PC.
15. Interfacing LCD to 8051.
16. Interfacing matrix or keyboard to 8051.
17. Data transfer from peripheral to memory through DMA controller 8237/8257
GCET 4|Page
Microprocessors and Microcontrollers lab Dept of ECE
DEPARTMENT OF ECE
Department of Electronics and Electronics Engineering is established in the
year 2006 to meet the requirements of the Electrical and Electronic industries such
as Vijay electrical, BHEL, BEL and society after the consultation with various
stakeholders.
Vision of ECE
To provide excellent Electrical and electronics education by building strong teaching
and research environment
Mission of ECE
GCET 5|Page
Microprocessors and Microcontrollers lab Dept of ECE
PEO 2. Graduates will analyze real life problems, design Electrical systems
appropriate to the requirement that are technically sound, economically
feasible and socially acceptable.
Programme Outcomes
The Program Outcomes of UG in Electrical and Electronics Engineering are as
follows:
PO 1. An ability to apply the knowledge of Mathematics, Science and Engineering in
Electrical and Electronics Engineering.
PO 2. An ability to design and conduct experiments pertaining to Electrical and
Electronics Engineering.
PO 3. An ability to function in multidisciplinary teams
PO 4. An ability to simulate and determine the parameters such as nominal voltage,
current, power and associated attributes.
PO 5. An ability to identify, formulate and solve problems in the areas of Electrical
and Electronics Engineering.
PO 6. An ability to use appropriate network theorems to solve electrical engineering
problems.
PO 7. An ability to communicate effectively.
PO 8. An ability to visualize the impact of electrical engineering solutions in global,
economic and societal context.
PO 9. Recognition of the need and an ability to engage in life-long learning.
GCET 6|Page
Microprocessors and Microcontrollers lab Dept of ECE
Course Overview:
Course Outcomes:
GCET 7|Page
Microprocessors and Microcontrollers lab Dept of ECE
6. Contrast how different I/O devices can be interfaced to processor and will
explore several techniques of interfacing.
7. Experiment with standard microprocessor interfaces including GPIO, serial
ports, digital-to-analog converters and analog-to-digital converters;
8. Make use of standard test and measurement equipment to evaluate digital
interfaces.
GCET 8|Page
Microprocessors and Microcontrollers lab Dept of ECE
3. While coming to the lab bring the lab manual cum observation book,
record etc.
4. Take only the lab manual, calculator (if needed) and a pen or pencil to
the work area.
5. Before coming to the lab, prepare the prelab questions. Read through
the lab experiment to familiarize yourself with the components and
assembly sequence.
10. Of the 25 marks for internal, 15 marks shall be awarded for day-to-day
work and 10 marks to be awarded by conducting an internal laboratory
test.
GCET 9|Page
Microprocessors and Microcontrollers lab Dept of ECE
1. Observation book and lab records submitted for the lab work are to be
checked and signed before the next lab session.
2. Students should be instructed to switch ON the power supply after the
connections are checked by the lab assistant / teacher.
3. The promptness of submission should be strictly insisted by awarding the
marks accordingly.
4. Ask viva questions at the end of the experiment.
5. Do not allow students who come late to the lab class.
6. Encourage the students to do the experiments innovatively.
LIST OF EXPERIMENTS
GCET 10 | P a g e
Microprocessors and Microcontrollers lab Dept of ECE
1. Study of TASM/MASM
2. 16-bit arithmetic Operations
3. Sorting an Array
4. Searching for Character in a String
5. Sting Manipulations
6. Digital Clock Design
7. Interfacing DAC
8. Interfacing ADC
INDEX
GCET 11 | P a g e
Microprocessors and Microcontrollers lab Dept of ECE
CYCLE -I
0 Study of TASM/MASM 13
3 Sorting an Array 37
5 Sting Manipulations 51
7 66
Interfacing DAC
8 70
Interfacing ADC
9 73
Serial communication between two 8086
microprocessors
10 81
Interfacing stepper motor
CYCLE-II
11 Introduction to 8051 85
GCET 12 | P a g e
Microprocessors and Microcontrollers lab Dept of ECE
GCET 13 | P a g e
Microprocessors and Microcontrollers lab Dept of ECE
STUDY OF MASM
Introduction:
The aim of this laboratory is to introduce the student to assembly language
programming and tools that she will need throughout the lab experiments.
Objectives:
1. Introduction to Microsoft Macro Assembler (MASM)
2. General structure of an assembly language program
3. Use of the Dos Debugger program
Overview:
In general, programming of microprocessor usually takes several iterations before
the right sequence of machine code instruction is written. The process, however is
facilitated using a special program called an Assembler. The Assembler allows the
user to write alphanumeric instructions. The Assembler, in turn, generates the
desired machine instructions from the assembly language instructions.
Assembly language programming consists of following steps:
STEP PRODUCES
1 Editing Source file
2 Assembling Object file
3 Linking Executable file
4 Executing Results
Assembling the program:
The assembler is used to convert the assembly language instructions to machine
code. It is used immediately after writing the Assembly language program. The
assembler starts checking the syntax or validity of the structure of each instruction in
the source file .if any errors are found, the assembler displays a report on these
errors along with brief explanation of their nature. However If the program doesnt
contain any errors, the assembler produces an object file that has the same name as
the original file but with the .obj extension.
Linking the program:
The Linker is used convert the object file to an executable file. The executable file is
the final set of machine code instructions that can directly be executed by the
microprocessor. It is the different than the object file in the sense that it is self-
contained and re-locatable. An object file may represent one segment of a long
program. This segment cannot operate by itself, and must be integrated with other
object files representing the rest of the program, in order to produce the final self-
contained executable file In addition to the executable file; the linker can also
generate a special file called the map file this file contains information about the
GCET 14 | P a g e
Microprocessors and Microcontrollers lab Dept of ECE
start, end, length of the stack, code, and data segments it also lists the entry point of
the program.
Executing the program
The executable file contains the machine language code .it can be loaded in the
RAM and executed by the microprocessor simply by typing, from the DOS prompt
,the name of the file followed by the carriage Return Key (Enter Key). If the program
produces an output on the screen or sequence of control signals to control a piece of
hard ware, the effect should be noticed almost immediately. However, if the program
manipulates data in memory, nothing would seem to have happened as a result of
executing the program.
Debugging the program
The debugger can also be used to find logical errors in the program. Even if a
program does not contain syntax errors it may not produce the desired results after
execution. Logical errors may be found by tracing the action of the program. once
found, the source file should be rewrite to fix the problem, then the re-assembled
and re-linked. A special program called the debugger is designed for that purpose.
The debugger allows the user to trace the action of the program, by single stepping
through the program or executing the program up to a desired point, called break
point. It also allows the user to inspect or change the contents of the microprocessor
internal registers or the contents of any memory location.
The DOS -Debugger:
The DOS Debug program is an example of simple debugger that comes with MS-
DOS. Hence it is available on any PC .it was initially designed to give the user the
capability to trace logical errors in executable file. It allows the user to take an
existing executable file and unassembled it, i.e. convert it to assembly language.
Also, it allows the user to write assembly language instructions directly, and then
convert them to machine language. The program is simple and easy to use, but
offers limited capabilities, which make it unsuitable for serious assembly language
programming. Below, are the summarized basic DOS - Debugger commands.
COMMAND SYNTAX
Assemble A [address]
Compare C range address
Dump D [range]
Enter E address [list]
Fill F range list
Go G [=address] [addresses]
Hex H value1 value2
Input I port
GCET 15 | P a g e
Microprocessors and Microcontrollers lab Dept of ECE
GCET 16 | P a g e
Microprocessors and Microcontrollers lab Dept of ECE
Open a DOS window. To assemble the file, change to the directory where the file is
via the 'cd'
Command, and type:
C:\> masm test
If assembly is successful, this will produce a file called test.obj. If errors are present,
the syntax errors with line numbers will be displayed. You can also produce a listing
file (.lst) which shows opcodes for all instructions via:
C:\> masm test, test, test
It is a good idea to always create a .lst file output. A .exe file must be created from
the .obj file via the link program. Type:
C:\> link test
You will be prompted for file names for the Run file, List file, libraries, and Definitions
file. Just hitting <enter> for each choice will use the defaults. This will produce a
test.exe file which can then be executed. You can also produce the .exe file with no
prompting from the link program via:
C:\> link test,,,,,
Use 5 commas after filename (test) to provide defaults for all other choices.
Using the command line for masm/link is probably the easiest thing to do, if you are
only assembling/linking one source file. Most of your labs will only consist of one
source file.
GCET 17 | P a g e
Microprocessors and Microcontrollers lab Dept of ECE
GCET 18 | P a g e
Microprocessors and Microcontrollers lab Dept of ECE
8086 ARCHITECTURE:
GCET 19 | P a g e
Microprocessors and Microcontrollers lab Dept of ECE
PIN DIAGRAM:
GCET 20 | P a g e
Microprocessors and Microcontrollers lab Dept of ECE
Logical Instructions
Arithmetic Instructions
Transfer Instructions
String Instructions
GCET 23 | P a g e
Microprocessors and Microcontrollers lab Dept of ECE
CYCLE-I
GCET 24 | P a g e
Microprocessors and Microcontrollers lab Dept of ECE
EXPERIMENT NO.1
OBJECTIVE:
To write an assembly language program for performing addition of two 16-bit signed and
unsigned numbers.
ALGORITHM:
Step I : Initialize the data memory.
Step II : Load the first number into AX register.
Step II : Load the second number into BX register.
Step IV : Add two lower digits.
Step V : Adjust result to valid BCD number.
Step VI : Store the result in BL.
Step VI : Add the two upper digits with carry.
Step VIII : Adjust result to valid BCD number.
Step IX : Store the result in BH.
Step X : Display the result.
Step XI : Stop.
GCET 25 | P a g e
Microprocessors and Microcontrollers lab Dept of ECE
FLOW CHART:
START
INITIALIZATION OF DATA
SEGMENT
AXOPR1
AXAX+OPR2
RESAX
RESULT: STOP
FLAGS:
Before execution, c=0, s=0, z=0, o=0, p=0, a=0, i=1, d=0.
After execution, c=0, s=0, z=0, o=0, p=1, a=0, i=1, d=0.
SIGNED NUMBERS
FLAGS:
Before execution, c=0, s=0, z=0, o=0, p=0, a=0, i=1, d=0.
After execution, c=1, s=0, z=0, o=1, p=0, a=0, i=1, d=0.
GCET 26 | P a g e
Microprocessors and Microcontrollers lab Dept of ECE
OUTCOME
Upon completion of this experiment, the student will be able to:
1. Employ the arithmetic instructions in various programs.
GCET 27 | P a g e
Microprocessors and Microcontrollers lab Dept of ECE
OBJECTIVE
To write an assembly language program to perform subtraction of two 16-bit signed and
unsigned numbers.
ALGORITHM:
FLOW CHART:
START
INITIALIZATION OF DATA
SEGMENT
AXOPR1
AXAX-OPR2
RESAX
STOP
RESULT
FLAGS:
Before execution, c=0, s=0, z=0, o=0, p=0, a=0, i=1, d=0.
After execution, c=0, s=0, z=0, o=0, p=1, a=0, i=1, d=0.
GCET 28 | P a g e
Microprocessors and Microcontrollers lab Dept of ECE
: OPR2 = 1000H
OUTPU : RES = 3269H
SIGNED NUMBERS
FLAGS:
Before execution, c=0, s=0, z=0, o=0, p=0, a=0, i=1, d=0.
After execution, c=0, s=0, z=0, o=0, p=1, a=0, i=1, d=0.
OUTCOME:
GCET 29 | P a g e
Microprocessors and Microcontrollers lab Dept of ECE
OBJECTIVE:
ALGORITHM:
Step I : Initialize the data memory.
Step II : Load the first number into AX register.
Step III : Load the second number into BX register.
Step IV : Multiply AX with BX.
Step V : store lower byte in accumulator.
Step VI : Store Upper byte in DX register
Step VII : Display the result.
Step VIII : Stop.
FLOW CHART:
START
INITIALIZATION OF
DATA SEGMENT
AXOPR1
AXAX*OPR2
RESLWAX
RESHWDX
STOP
GCET 30 | P a g e
Microprocessors and Microcontrollers lab Dept of ECE
RESULT:
FLAGS:
Before execution, c=0, s=0, z=0, o=0, p=0, a=0, i=1, d=0.
After execution, c=1, s=0, z=0, o=1, p=0, a=0, i=1, d=0.
OUTCOME:
Upon completion of this experiment, the student will be able to:
GCET 31 | P a g e
Microprocessors and Microcontrollers lab Dept of ECE
OBJECTIVE:
To write an assembly language program to perform division of 16-bit unsigned
number by 8-bit unsigned number.
ALGORITHM:
Step I : Initialize the data memory.
Step II : Load the first number into AX register.
Step III : Load the second number into BX register.
Step IV : Divide AX by BX.
Step V : store Quotient in AL register.
Step VI : Store reminder in AH register
Step VII : Display the result.
Step VIII : Stop.
FLOW CHART:
START
INITIALIZATION OF DATA
SEGMENT
DIVISION OF AX BY OPR2
AXAX/OPR2
RESQAL
RESRAH
STOP
GCET 32 | P a g e
Microprocessors and Microcontrollers lab Dept of ECE
RESULT:
FLAGS:
Before execution, c=0, s=0, z=0, o=0, p=0, a=0, i=1, d=0.
After execution, c=0, s=0, z=0, o=0, p=0, a=1, i=1, d=0.
INPUT:
OPR1 = 2C58H (DIVIDEND)
OPR2 = 56H (DIVISOR)
OUTPUT:
RESQ = 84H (AL)
RESR = 00H (AH)
VIVA QUESTIONS:
6) What is pipelineing?
11)
OUTCOME
GCET 33 | P a g e
Microprocessors and Microcontrollers lab Dept of ECE
EXPERIMENT NO.2
I.ASCENDING ORDER
OBJECTIVE:
To write an assembly language program to arrange the given numbers in ascending
order.
ALGORITHM:
GCET 34 | P a g e
Microprocessors and Microcontrollers lab Dept of ECE
Step XI : Stop.
START
DXCOUNT-1
BACK : CXDX
SIOFFSET
ADDRESS OF LIST
AGAIN: AX[SI]
IF TRUE
AX < [SI+2]
FALSE
EXCHANGE
[SI] &[SI+2]
INCREMENT SI BY 2
FALSE
IF
CX= TRUE
0
DECREMENT DX
FALSE
IF
DX=
GCET 35 | P a g e
0
TRUE
STOP
Microprocessors and Microcontrollers lab Dept of ECE
RESULT:
OUTCOME:
Upon completion of this experiment the student will be able to:
1. Demonstrate the control transfer instructions.
2. Explain number searches and differentiates bigger and smaller numbers from
large database.
GCET 36 | P a g e
Microprocessors and Microcontrollers lab Dept of ECE
ALGORITHM:
GCET 37 | P a g e
Microprocessors and Microcontrollers lab Dept of ECE
START
INITIALIZATION OF
DATA SEGMENT
BACK : CXDX
SIOFFSET
ADDRESS OF LIST
AGAIN: AX[SI]
IF TRUE
AX <
[SI+2]
FALSE
EXCHANGE
[SI] &[SI+2]
INCREMENT SI BY 2
FALSE
IF
CX=
TRUE
0
DECREMENT DX
FALSE
IF
DX=
GCET 38 | P a g e
0
TRUE
STOP
Microprocessors and Microcontrollers lab Dept of ECE
RESULT:
VIVA QUESTIONS:
OUTCOME:
Upon completion of this experiment the student will be able to:
1. Demonstrate the control transfer instructions.
2. Explain number searches and differentiates bigger and smaller numbers from
large database.
GCET 39 | P a g e
Microprocessors and Microcontrollers lab Dept of ECE
EXPERIMENT NO.3
PROGRAM FOR SEARCHING FOR A NUMBER/CHARACTER IN A STRING FOR
8086 MICROPROCESSOR
OBJECTIVE:
To find whether the given byte is in given string or not & find its relative address
ALGORITHM:
Step V : Scan for the byte in ES. If the byte is found ZF=0,move the address
pointed by S:DI to BX
.
Step VI : Store the result
GCET 40 | P a g e
Microprocessors and Microcontrollers lab Dept of ECE
GCET 41 | P a g e
Microprocessors and Microcontrollers lab Dept of ECE
FLOWCHART:
START
INITIALIZATION OF DATA
SEGMENT
ALBYTE CLCOUNT,
BX=00,SI, OFFSET LIST
Yes
IF AL=[SI]
Increment BX
Increment SI,Decrement CL
no
If
yes
CL=0
NOP
STOP
RESULT:
GIVEN DATA:
N=19H,99H,45H,46H,34H
BYTE= 45H
FLAGS:
INITIALLY: C=0,Z=0,S=0,O=0,P=0,A=0,I=1,D=0
AFTER EXECUTION: C=0,Z=1,S=0,O=0,P=1,A=0,I=1,D=0
GCET 42 | P a g e
Microprocessors and Microcontrollers lab Dept of ECE
OUTPUT:
RES: 45H
ADDRESS: BX----0002
VIVA QUESTIONS:
OUTCOME:
Upon completion of this experiment the student will be able to:
1. .Demonstrate the control transfer instructions.
2. Explain number searches and differentiates bigger and smaller numbers
from large database.
EXPERIMENT NO.4
GCET 43 | P a g e
Microprocessors and Microcontrollers lab Dept of ECE
OBJECTIVE:
To write an assembly language program to find the length of the given string.
ALGORITHM:
NOP
Unco
nditio
nal
Jump
NOP
FLOW CHART
LENGTHCL
GCET 44 | P a g e
STOP
Microprocessors and Microcontrollers lab Dept of ECE
GCET 45 | P a g e
Microprocessors and Microcontrollers lab Dept of ECE
RESULT:
OUTPUT: LENGTH =
OUTCOME:
Upon completion of this experiment the student will be able to:
1. Describe the memory management and select the proper memory.
2. Demonstrate the control transfer instructions
GCET 46 | P a g e
Microprocessors and Microcontrollers lab Dept of ECE
OBJECTIVE:
To write an assembly language program to display the given string.(DOS PROGRAMMING)
ALGORITHM:
GCET 47 | P a g e
Microprocessors and Microcontrollers lab Dept of ECE
FLOWCHART
RESULT
WELCOME TO MICROPROCESSORS LAB
OUTCOME:
Upon completion of this experiment the student will be able to:
1.Describe the memory management and select the proper memory.
2.Demonstrate the DOS Interrupts.
GCET 48 | P a g e
Microprocessors and Microcontrollers lab Dept of ECE
OBJECTIVE:
To write an assembly language program to reverse the given string.
ALGORITHM:
Step III : In code segment move the data segment value to data segment
register
Step IV : Move count value (count +1) to count register and define offset
address of destination to DI and move 04 H to DX
Step V : Define offset address of src to SI then move SI to BX and then BX to
DX
Step VI : Decrement the destination index then subtract source index value
GCET 49 | P a g e
Microprocessors and Microcontrollers lab Dept of ECE
FLOW CHART:
START
INITIALIZATION OF DATA
SEGMENT
CLCOUNT
SIoffset address of STR1
DICOUNT-1
[DI]=[SI]
INC SI
DEC DI
DEC CL
FALS
If
E
CL=
0
TRUE
STOP
RESULT:
GCET 50 | P a g e
Microprocessors and Microcontrollers lab Dept of ECE
VIVA QUESTIOS:
4) What is the relation between 8086 processor frequency & crystal Frequency?
OUTCOME: Upon completion of this experiment the student will be able to:
1.Describe the memory management and select the proper memory.
2.Demonstrate the control transfer instructions
GCET 51 | P a g e
Microprocessors and Microcontrollers lab Dept of ECE
EXPERIMENT NO.5
OBJECTIVE:
To write an assembly language program to display current system time.(DOS
PROGRAMMING)
ALGORITHM:
GCET 52 | P a g e
Microprocessors and Microcontrollers lab Dept of ECE
VIVA QUESTIONS:
1) Functions of BX register?
2) Functions of CX register?
3) Functions of DX register?
OUTCOME:
Upon completion of this experiment the student will be able to Demonstrate
displaying current system time using DOS programming.
GCET 53 | P a g e
Microprocessors and Microcontrollers lab Dept of ECE
EXPERIMENT NO.6
OBJECTIVE:
To write a Program to generate following wave forms
a. Ramp waveform
b. Square waveform
c. Step waveform
d. Triangle waveform
GCET 54 | P a g e
Microprocessors and Microcontrollers lab Dept of ECE
ALGORITHM:
Waveform generation:
GCET 55 | P a g e
Microprocessors and Microcontrollers lab Dept of ECE
FLOWCHART
Saw-tooth waveform:
FLOWCHART
GCET 56 | P a g e
Microprocessors and Microcontrollers lab Dept of ECE
Triangular waveform:
FLOWCHART
RESULT: Thus the DAC was interfaced with 8085 and different
waveforms have been generated.
GCET 57 | P a g e
Microprocessors and Microcontrollers lab Dept of ECE
Outcome: Upon completion of this experiment the student will be able to:
1.Demonstrate and 8255 PPI how the 8086 microprocessor is interfaced.
2.Design 8086 microprocessor system by using the peripheral devices
3. Interpret the data transfer from 8086 microprocessor to the peripheral device and
vice versa.
GCET 58 | P a g e
Microprocessors and Microcontrollers lab Dept of ECE
EXPERIMENT NO.7
ALGORITHM
GCET 59 | P a g e
Microprocessors and Microcontrollers lab Dept of ECE
FLOWCHART
RESULT:
Thus the ADC was interfaced with 8086 and the givenanalog inputs were converted
into its digital equivalent
VIVA QUESTIONS:
GCET 60 | P a g e
Microprocessors and Microcontrollers lab Dept of ECE
Outcome: Upon completion of this experiment the student will be able to:
1.Demonstrate and 8255 PPI how the 8086 microprocessor is interfaced.
2.Design 8086 microprocessor system by using the peripheral devices
3. Interpret the data transfer from 8086 microprocessor to the peripheral device and
vice versa.
GCET 61 | P a g e
Microprocessors and Microcontrollers lab Dept of ECE
EXPERIMENT NO.8
PROCEDURE :
Transmission
1. Connect 8086 kit PC using RS232 cable.
2. Connect Power supply to 8086 kit and 8251 interfacing kit(only blue(+5v) and
black(0v) lines Power cable to power supply)
3. Connect 8251 to 8086 using 50pin and 26pin bus.
4. Short 5 & 6 pins of JP9 in 8251 kit
5. Keep the DIP switch in 1 & 7 on (8086kit), open TALK, and go to options select
target device as 8086 and Connect.
6. Change dip switch into 1 & 5on, once reset 8086 kit.
7. Go to file Download hex file
8. G-4000(on system keyboard), we can observe the output on 8251 kit.
9. Remove RS232 cable from 8086kit and connect it to 8251, transmitted data
displayed on PC Monitor
RECEIVEING
GCET 62 | P a g e
Microprocessors and Microcontrollers lab Dept of ECE
ALGORITHM
Step I Initialize 8253 and 8251 to check the transmission and reception of a
character
Step II Initialize8253 to give an output of 150Khz at channel 0 which will give a
9600 baud rate of 8251.
Step III The command word and mode word is written to the 8251 to set up for
subsequent operations
Step IV The status word is read from the 8251 on completionof a serial I/O
operation, or when the host CPU is checking the status of the device before starting
the next I/O operation
FLOWCHART
GCET 63 | P a g e
Microprocessors and Microcontrollers lab Dept of ECE
VIVA-VOCE QUESTIONS:
1. Expand USART?
2. Where do we prefer the serial communication?
3. What is the function of instruction pointer (IP) register?
4. What is the difference between IN and OUT instructions?
5. What is MODEM?
OUTCOME: Upon completion of this experiment the student will be able to:
1.Demonstrate and 8255 PPI how the 8086 microprocessor is interfaced.
2.Design 8086 microprocessor system by using the 8251 peripheral devices
3. Interpret the data transfer from 8086 microprocessor to the peripheral device and
vice versa.
GCET 64 | P a g e
Microprocessors and Microcontrollers lab Dept of ECE
Fig1.8251 CONNECTIONS
GCET 65 | P a g e
Microprocessors and Microcontrollers lab Dept of ECE
EXPERIMENT NO.9
OBJECTIVE: Write a program in ALP to interface stepper motor to 8086 and rotate it
in clockwise And anticlockwise direction.
ALGORITHM:
GCET 66 | P a g e
Microprocessors and Microcontrollers lab Dept of ECE
GCET 67 | P a g e
Microprocessors and Microcontrollers lab Dept of ECE
RESULT:
Thus the assembly language program for rotating stepper motor in both clockwise
and anticlockwise directions is written and verified.
VIVA QUESTIONS:
1) What is the difference between min mode and max mode of 8086?
Outcome: Upon completion of this experiment the student will be able to:
1.Demonstrate and 8255 PPI how the 8086 microprocessor is interfaced.
2.Design 8086 microprocessor system by using the peripheral devices
3. Interpret the data transfer from 8086 microprocessor to the peripheral device and
vice versa.
GCET 68 | P a g e
Microprocessors and Microcontrollers lab Dept of ECE
INTRODUCTION TO 8051
The Intel 8051 is Harvard architecture, single chip microcontroller (C) which was
developed by Intel in 1980 for use in embedded systems. 8051 is an 8-bit micro
controller. The Important features of 8085 Architecture:
GCET 69 | P a g e
Microprocessors and Microcontrollers lab Dept of ECE
GCET 70 | P a g e
Microprocessors and Microcontrollers lab Dept of ECE
/INT0 /INT1 T0 T1
Other
interrupts
8051 CPU
From Crystal
Oscillator or RC ALE /PSEN P3 P2 P1 P0 TxD RxD
network (Address/data)
Architecture of 8051
Types of instructions:
Depending on operation they perform, all instructions are divided in several groups:
Arithmetic Instructions
Branch Instructions
Data Transfer Instructions
Logic Instructions
Bit-oriented Instructions
Arithmetic instructions:
ADD A,R1 - The result of addition (A+R1) will be stored in the accumulator.
GCET 71 | P a g e
Microprocessors and Microcontrollers lab Dept of ECE
Mnemonic Description
ADD A,Rn Adds the register to the accumulator
ADD A,direct Adds the direct byte to the accumulator
ADD A,@Ri Adds the indirect RAM to the accumulator
ADD A,#data Adds the immediate data to the accumulator
ADDC A,Rn Adds the register to the accumulator with a carry flag
ADDC A,direct Adds the direct byte to the accumulator with a carry flag
ADDC A,@Ri Adds the indirect RAM to the accumulator with a carry flag
ADDC A,#data Adds the immediate data to the accumulator with a carry flag
SUBB A,Rn Subtracts the register from the accumulator with a borrow
SUBB A,direct Subtracts the direct byte from the accumulator with a borrow
SUBB A,@Ri Subtracts the indirect RAM from the accumulator with a borrow
SUBB A,#data Subtracts the immediate data from the accumulator with a borrow
INC A Increments the accumulator by 1
INC Rn Increments the register by 1
INC Rx Increments the direct byte by 1
INC @Ri Increments the indirect RAM by 1
DEC A Decrements the accumulator by 1
DEC Rn Decrements the register by 1
DEC Rx Decrements the direct byte by 1
DEC @Ri Decrements the indirect RAM by 1
INC DPTR Increments the Data Pointer by 1
MUL AB Multiplies A and B
DIV AB Divides A by B
DA A Decimal adjustment of the accumulator according to BCD code
Branch Instructions:
Unconditional jump instructions: upon their execution a jump to a new location from
where the program continues execution is executed.
Mnemonic Description
ACALL addr11 Absolute subroutine call
GCET 72 | P a g e
Microprocessors and Microcontrollers lab Dept of ECE
Data transfer instructions move the content of one register to another. The
register the content of which is moved remains unchanged. If they have the suffix X
(MOVX), the data is exchanged with external memory.
Mnemonic Description
MOV A,Rn Moves the register to the accumulator
MOV A,direct Moves the direct byte to the accumulator
MOV A,@Ri Moves the indirect RAM to the accumulator
MOV A,#data Moves the immediate data to the accumulator
MOV Rn,A Moves the accumulator to the register
MOV Rn,direct Moves the direct byte to the register
MOV Rn,#data Moves the immediate data to the register
MOV direct,A Moves the accumulator to the direct byte
GCET 73 | P a g e
Microprocessors and Microcontrollers lab Dept of ECE
Logic Instructions:
Mnemonic Description
ANL A,Rn AND register to accumulator
ANL A,direct AND direct byte to accumulator
ANL A,@Ri AND indirect RAM to accumulator
ANL A,#data AND immediate data to accumulator
ANL direct,A AND accumulator to direct byte
ANL direct,#data AND immediate data to direct register
ORL A,Rn OR register to accumulator
ORL A,direct OR direct byte to accumulator
ORL A,@Ri OR indirect RAM to accumulator
ORL direct,A OR accumulator to direct byte
ORL direct,#data OR immediate data to direct byte
XRL A,Rn Exclusive OR register to accumulator
GCET 74 | P a g e
Microprocessors and Microcontrollers lab Dept of ECE
Bit-oriented Instructions
A - accumulator;
Rn - is one of working registers (R0-R7) in the currently active RAM memory
bank;
Direct - is any 8-bit address register of RAM. It can be any general-purpose
register or a SFR (I/O port, control register etc.);
GCET 75 | P a g e
Microprocessors and Microcontrollers lab Dept of ECE
GCET 76 | P a g e
Microprocessors and Microcontrollers lab Dept of ECE
EXPERIMENT NO. 10
PROCEDURE:
GCET 77 | P a g e
Microprocessors and Microcontrollers lab Dept of ECE
1. Connect the 8051 kit to the processor of desktop with Rs232 cable and power
supply to the 8051 Kit.
2. Open the TALK icon which is on desktop now Talk window appears.
3. In that window go to options Target Board 8051 ok.
4. Go to options Connect.
5. Press E on kit keyboard to activate serial port of the kit. Now SERIAL PORT
displays on the kit and ALS 8051 STA displays on talk window.
6. Go to file Download Hex file. Select the HEX file which is generated by
following the path D drive driver X8051 filename.hex. Now I appears on Talk
window to indicate that file is downloaded.
7. Type G and Starting address of HEX file and press enter.
8. Now program gets executed and register status will be displayed.
9. To generate opcode Press Z starting address of hex file and enter.
I.ARITHEMATIC OPERATIONS
ALGORITHM:
GCET 78 | P a g e
Microprocessors and Microcontrollers lab Dept of ECE
FLOWCHART
GCET 79 | P a g e
Microprocessors and Microcontrollers lab Dept of ECE
FLOWCHART
GCET 80 | P a g e
Microprocessors and Microcontrollers lab Dept of ECE
Multiplication
FLOWCHART
GCET 81 | P a g e
Microprocessors and Microcontrollers lab Dept of ECE
Division
FLOWCHART
GCET 82 | P a g e
Microprocessors and Microcontrollers lab Dept of ECE
II.LOGICAL OPERATIONS
ALGORITHM:
Step 1 : Initialize content of accumulator as FFH
FLOW CHART
GCET 83 | P a g e
Microprocessors and Microcontrollers lab Dept of ECE
ALGORITHM:
Step 1 : Initialize content of accumulator as FFH
FLOW CHART
GCET 84 | P a g e
Microprocessors and Microcontrollers lab Dept of ECE
VIVA QUESTIONS:
RESULT:
OUTCOME:
Upon completion of this experiment the student will be able to perform Arithmetic,
logical and bit manipulation operations.
GCET 85 | P a g e
Microprocessors and Microcontrollers lab Dept of ECE
EXPERIMENT NO.11
OBJECTIVE:
To program and verify Timer/counter in 8051(Timer 0 mode 2 counter).
PROCEDURE:
1. Connect the 8051 kit to the processor of desktop with Rs232 cable and power
supply to the 8051 Kit.
2.Short 1 & 2 pins of JP1 of Study card.
3.Connect NIFC 26 study card to the 8051 using 50 line bus (P2 of 8051 kit to study
card) and 10 line bus (JP12 of 8051 kit to JP3 of Study card).
4.Now switch on the power supply.
5. Open the TALK icon which is on desktop now Talk window appears.
6. In that window go to options Target Board 8051 ok.
7. Go to options Connect.
8. Press E on kit keyboard to activate serial port of the kit. Now SERIAL PORT
displays on the kit and ALS 8051 STA displays on talk window.
9. Go to file Download Hexfile. Select the HEX file by following the path E drive
Talk MC COMM Nifc26Nifc26. Now I appears on TALk window to indicate
that file is downloaded.
10. Type G 9200 (Starting address) and press enter.
11. Now program gets executed
12. Now data location displays on the LCD display of Kit and by pressing SW1 of
study card we can observe the increment in the data field displayed.
GCET 86 | P a g e
Microprocessors and Microcontrollers lab Dept of ECE
ALGORITHM:
FLOWCHART
GCET 87 | P a g e
Microprocessors and Microcontrollers lab Dept of ECE
VIVA QUESTIONS:
RESULT:
OUTCOME:
GCET 88 | P a g e
Microprocessors and Microcontrollers lab Dept of ECE
EXPERIMENT NO.12
OBJECTIVE:
To program and verify interrupt handling in 8051
PROCEDURE:
1.Connect the 8051 kit to the processor of desktop with Rs232 cable and power
supply to the 8051 Kit.
2.Short 1 & 2 pins of JP5 and JP6 of Study card.
3.Connect NIFC 26 study card to the 8051 using 50 line bus (P2 of 8051 kit to study
card) and 10 line bus (JP12 of 8051 kit to JP3 of Study card).
4.Now switch on the power supply.
5. Open the TALK icon which is on desktop now Talk window appears.
6. In that window go to options Target Board 8051 ok.
7. Go to options Connect.
8. Press E on kit keyboard to activate serial port of the kit. Now SERIAL PORT
displays on the kit and ALS 8051 STA displays on talk window.
9. Go to file Download Hexfile. Select the HEX file by following the path E drive
Talk MC COMM Nifc26Nifc26. Now I appears on TALk window to indicate
that file is downloaded.
10. Type G 9700 (Starting address) and press enter.
11. Now program gets executed
12. Now data location displays on the LCD display of Kit (continues swapping of bits
26)
GCET 89 | P a g e
Microprocessors and Microcontrollers lab Dept of ECE
13. Give an external interrupt by pressing sw3 on study card now you can observe
that data field counts from 0 to 2 and continues swapping of bits 26
ALGORITHM :
Step1 : Load IE register with respect to interrupts to be handled
Step 2 : Load TMOD register with MOD and Timer information.
Step 3 : Load timer registers
Step 4 : Wait for an interrupt. If interrupt occurs, the control has to be
passed to sub-routine by calculating interrupt vector
Step 5 : By executing RETI instruction the control will execute the main
program.
FLOWCHART:
GCET 90 | P a g e
Microprocessors and Microcontrollers lab Dept of ECE
VIVA QUESTIONS:
RESULT:
OUTCOME:
This program demonstrates the usage of priority bit and external internal type bit to
handle the interrupt.
GCET 91 | P a g e
Microprocessors and Microcontrollers lab Dept of ECE
ADDITIONAL EXPERIMENTS
GCET 92 | P a g e
Microprocessors and Microcontrollers lab Dept of ECE
Step 1: Give a double click on vision3 icon on the desktop, it will generate a
window as shown below:
GCET 93 | P a g e
Microprocessors and Microcontrollers lab Dept of ECE
Step 8: After selecting chip click on OK then it will display some window asking to
add STARTUP file. Select YES.
Step 9: A target is created and startup file is added to your project target and is
shown below.
Step 10: To write your project code select a new file from FILE menu bar.
Step 11: It will display some text editor, to save that file select SAVE option from
FILE menu bar.
GCET 94 | P a g e
Microprocessors and Microcontrollers lab Dept of ECE
Step 15:It will displays some window there select the file you have to add and
click on ADD option.
Step 16: The file will be added to target and it is shown in the project window.
Step 17: Now give a right click on target in the project window and select Options
for Target.
GCET 95 | P a g e
Microprocessors and Microcontrollers lab Dept of ECE
Step 18: It will show some window, in that go to output option and choose Create
Hex file option by selecting that box.
Step 19: In the same window go to Linker option and choose use memory layout
from target dialog by selecting the box, and Click OK.
Step 20: Now to compile your project Select build target option or press F7.
Step 21: In the build OUTPUT window, you can see the errors and warnings of the
code. Project HEX file will be created.
GCET 96 | P a g e
Microprocessors and Microcontrollers lab Dept of ECE
Experiment No: 13
SERIAL TRANSMISSION FROM PC TO 8051C
OBJECTIVE:
To transmit characters from PC to 8051uc serially and to see the output on terminal
window.
ALGORITHM:
Step1 : The TMOD register is loaded with the value 20H, indicating the
use of Timer 1 in mode 2 (8-bit auto-reload) to set the baud rate
.
Step2 : The TH1 is loaded with one of the values TO set the baud rate
For serial data transfer (assuming XTAL = 11.0592 MHz).
Step 3 : The SCON register is loaded with the value 50H, indicating
serial mode 1,where an 8-bit data is framed with start and stop
bits.
GCET 97 | P a g e
Microprocessors and Microcontrollers lab Dept of ECE
FLOWCHART
RESULT:
By connecting 8051 to PC students can transmit data serially.
OUTCOME:
Students will be able to understand
1) Demonstration of serial communication
2) How to interface UART.
GCET 98 | P a g e
Microprocessors and Microcontrollers lab Dept of ECE
Experiment No: 14
PORT PROGRAMMING OF 8051
OBJECTIVE:
To write 8051 C program to toggle all the bits of P0 and P2 continuously with some
delay.
ALGORITHM
Step1 : The TMOD register is loaded with the value 20H, indicating the
Step 2 : TH1 is loaded with one of the values in to set the baud rate
Step 3 : The SCON register is loaded with the value 50H, indicating
serial mode 1,where 8-bit data is framed with start and stop
Step 6 : The RI flag bit is monitored with the use of the instruction JNB
step 7 : When RI is raised, SBUF has the byte. Its contents are moved
GCET 99 | P a g e
Microprocessors and Microcontrollers lab Dept of ECE
FLOW CHART
RESULT:
By this program students are able to toggle all the bits of two ports with some delay.
OUTCOME:
By the end of this program students will be able to understand the port
programming.
GCET 100 |
Page
Microprocessors and Microcontrollers lab Dept of ECE
1. Define microprocessor.
A) A microprocessor is a multipurpose, programmable, clock-driven, register-based
electronic device that reads binary instructions from a storage device called memory
accepts binary data as input and processes data according to instructions, and
provides result as output.
2. Define microcomputer.
A) A computer that is designed using a microprocessor as its CPU, It includes
microprocessor, memory, and I/O.
3. Define ROM.
A) A memory that stores binary information permanently, the information can be read
from this memory but cannot be altered.
4. What is an ALU?
A) The group of circuits that provides timing and signals to all the operations in the
computer also controls data flow.
6. What is an instruction?
A) An instruction is a binary pattern entered through an input device in memory to
command the microprocessor to perform specific function.
GCET 101 |
Page
Microprocessors and Microcontrollers lab Dept of ECE
A) The 8085 MPU with its 14-bit address is capable of addressing 214 =16,384 (ie)
16K memory locations.
14. Why are the program counter and the stack pointer 16-bit registers?
A) Memory locations for the program counter and stack pointer have 16-bit
addresses. So the PC and SP have 16-bit registers.
16. Specify the number of registers and memory cells required in a 128 x 4
memory chip.
A) Number of registers = 128
Memory cells required is 128 x 4=512
17. Explain the function of ALE and IO/M signals in the 8086 architecture.
A) The ALE signal goes high at the beginning of each machine cycle indicating the
availability of the address on the address bus, and the signal is used to latch the
low- order address bus. The IO/M signal is a status signal indicating whether the
machine cycle is I/O or memory operation. The IO/M signal is combined with the RD
and WR control signals to generate IOR, IOW, MEMW,MEMR .
18. Specify the contents of the accumulator and the status of the S, Z, and CY
flags, if 8086 adds 87H and 79H.
A) The sum of 87H and 79H is 100H. Therefore, the accumulator will have 00H, and
the flags will be S=0, Z = 1, CY = 1
S Z AC P CY
GCET 103 |
Page
Microprocessors and Microcontrollers lab Dept of ECE
First byte
MVI A, Data 011 1110 3E
Data Data SecondByte
6. Write an instruction to load the hexadecimal numbers 65H in register C, and 92H
in the accumulator A, and display the number 65H at PORT0 and 92H at PORT1?
C,
MVI
65H
A,
MVI
92H
OUT PORT1 ; DISPLAY 92H
; COPY C INTO A FOR
MOVA, C
DISPLAY
OUT PORT0 ; DISPLAY 65H
HLT
1-byte instruction
2-byte instruction
3-byte instruction
GCET 104 |
Page
Microprocessors and Microcontrollers lab Dept of ECE
A) It changes the program sequence to the location specified by the 16-bit address if
the carry flag is reset.
A) ASCII code is a 7-bit code that represents both decimal numbers, alphabets.
Extended ASCII is an 8-bit code.
GCET 105 |
Page
Microprocessors and Microcontrollers lab Dept of ECE
45. Why the number of out ports in the peripheral-mapped I/O is restricted to
256 ports?
A) The number of output ports in the peripheral I/O is restricted to 256 ports because
the operand of the OUT instruction is 8-bits; it can have only 256 combinations
46. If an input and output port can have the same 8-bit address how does the
8085 differentiate between the ports.
A) In The 8085 differentiates between the input and output ports of the same
address by the control signal. The input port requires the RD and the output port
requires the WR signal.
47. What are the control signals necessary in the memory mapped I/O?
A) RD, WR, I/O (low)
48. Why a latch is used for the output port and a tri-state buffer is used for the
input port?
A) A latch is necessary to hold the output data for display. The input data byte is
obtained by enabling a tri-state buffer and placed in the accumulator.
49. What happens when the 8086 execute the out instruction?
A) When the 8086 executes the out instruction, in the third machine cycle, it places
the output port address on the low-order address bus, duplicates the same port
address on the high-order bus, places the contents of the accumulator on the data
bus and asserts the control signal WR.
50. How does the port number be affected if we decode the higher-order
address lines A15 A8 rather than lower-order address lines A7 A0?
A) The port address will remain the same because the I/O port address is duplicated
on both segments of the address bus.
GCET 106 |
Page
Microprocessors and Microcontrollers lab Dept of ECE
56. Specify the bit of a control word for the 8255, which differentiates between
the I/O mode and the BSR mode.
A) BSR mode D7= 0, and I/O mode D5 = 1
57. Write the input/output feature in Mode 0 for the 8255A PPI?
A) Outputs are latched
Inputs are not latched
Ports do not have handshake or interrupt capability
BSR
Not used Set = 1
mode
Generally
Set= 0
59. Write down the output control signals used in 8255A PPI.
A) OBF output Buffer Full
ACK Acknowledge
INTR Interrupt request
INTE Interrupt Enable
GCET 107 |
Page
Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.
Alternative Proxies: