0% found this document useful (0 votes)
56 views58 pages

MPMC Final - ECE

Lab manual of ece

Uploaded by

Madduri James
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
56 views58 pages

MPMC Final - ECE

Lab manual of ece

Uploaded by

Madduri James
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

UCE, AKNU MICROPROCESSOR AND MICROCONTROLLER LAB

MICROPROCESSOR AND
MICROCONTROLLER LABORATORY
MANUAL
III – B. Tech., II-Semester ECE

DEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING

UNIVERSITY COLLEGE OF ENGINEERING

ADIKAVI NANNAYA UNIVERSITY

ELECTRONICS AND COMMUNICATION ENGINEERING Page 1


UCE, AKNU MICROPROCESSOR AND MICROCONTROLLER LAB

PREFACE

The significance of the Microprocessors and Microcontrollers Lab is


renowned in the various fields of engineering applications. For an Electronic
Engineer, it is obligatory to have the practical ideas about the applications of
Microprocessors and Microcontrollers. By this perspective we have introduced a
Laboratory manual cum Observation for Microprocessors and Microcontrollers Lab.

The manual uses the plan, cogent and simple language to explain the
fundamental aspects of Microprocessors and Microcontrollers in practical. The
manual prepared very carefully with our level best. It gives all the steps in executing
an experiment.

ELECTRONICS AND COMMUNICATION ENGINEERING Page 2


UCE, AKNU MICROPROCESSOR AND MICROCONTROLLER LAB

GUIDELINES TO WRITE YOUR OBSERVATION BOOK

1. Assembly Language Programs (ALP’s), Algorithm, Theoretical Result and


Practical Result should be on rightside.
2. Flow Chart should be leftside.
3. Result should always be in the ending.
4. You all are advised to leave sufficient no of pages between ALP’s for
theoretical or model calculations purpose.

DO’S AND DON’TS IN THE LAB

DO’S:-

1. Proper dress has to be maintained while entering in the Lab. (should be


neatlydressed)
2. Students should carry observation notes and record completed in all aspects.
3. ALP and its theoretical result should be there in the observation before
coming to the nextlab.
4. Student should be aware of next ALPs.
5. After completing the ALP Students should verify the ALP by the Lab
Instructor.
6. The Practical Result should be noted down into their observations and result
must be shown to the Lecturer In-Charge for verification.

DON’Ts:-
1. Don’t come late to the Lab.
2. Don’t leave the Lab without making proper shut down of desktop and keeping
the chairs properly.
3. Don’t leave the Lab without verification by Lab instructor.
4. Don’t leave the lab without the permission of the Lecturer In-Charge.

ELECTRONICS AND COMMUNICATION ENGINEERING Page 3


UCE, AKNU MICROPROCESSOR AND MICROCONTROLLER LAB

MICROPROCESSORS AND MICROCONTROLLERS LAB


Syllabus

PART- A: 8086 Assembly Language Programming using Assembler Directives

1. Sorting.
2. Multibyte addition/subtraction.
3. Sum of squares/cubes of a given n-numbers.
4. Addition of n-BCD numbers.
5. Factorial of given n-numbers.
6. Multiplication and Division operations.
7. Stack operations.
8. BCD to Seven segment display codes.

PART- B: 8086 interfacing

1. Hardware/Software Interrupt Application.


2. A/D Interface through Intel 8255.
3. D/A Interface through Intel 8255.
4. Keyboard and Display Interface through Intel 8279.
5. Generation of waveforms using Intel 8253/8254.

PART- C: 8051 Assembly Language Programs

1. Finding number of 1’s and number of 0’s in a given 8-bit number.


2. Addition of even numbers from a given array.
3. Ascending / Descending order.
4. Average of n-numbers.

PART-D: 8051 Interfacing

1. Switches and LEDs.


2. 7-Segment display (multiplexed).
3. Stepper Motor Interface.
4. Traffic Light Controller.

ELECTRONICS AND COMMUNICATION ENGINEERING Page 4


UCE, AKNU MICROPROCESSOR AND MICROCONTROLLER LAB

MICROPROCESSOR TRAINERKIT

The microprocessor trainer kit (microprocessor development kit) is an aidto


understand the architecture, interfacing and programming of a microprocessor.
Here we describe the ESA 86/88 E-trainer kit.

ESA86/88E,is an economical and powerful general-purpose microcomputer system


the can be operated with 8086 or 8088 CPU that maybe used as an instruction
alandlearningaidandalsoas a develop menttoolin R&D lab sand industries.

ESA86/88Ecan be operated on single +5 Volts power supply instand-alone mode


using LCD and optional PC/AT keyboard or inserial mode with a host computer
through its RS-232Cinterface. user-friendly Windows and DOS Driver packages
supplied with ESA86/88E provide for a powerful and versatile Assembly level
programming/debugging environment.

On board Peripherals &I nterfacingOptions:

 8251A-
UniversalSynchronous/AsynchronousReceiver/Transmittersupportingstandardbau
d ratesfrom110to19,[Link]-boardDIPswitchsetting.
 8253-5-
ProgrammableIntervalTimer;Timer0isusedforBaudclockgenerationTimer1and
Timer2areavailabletotheuser.
 8255A-3ProgrammablePeripheralInterfaceProvideup
to72ProgrammableI/[Link]
8255isusedforcontrollingLCDandreadingDIPSwitch.Two8255sarefortheuser,
of which one is populated by default and the otherisoptional.
 8288-BusControllerusedforgeneratingcontrolinMaximumModeOperation.
 8042/8742UPI(UniversalPeripheralInterface).

ESA86/88ECONFIGURATION

ELECTRONICS AND COMMUNICATION ENGINEERING Page 5


UCE, AKNU MICROPROCESSOR AND MICROCONTROLLER LAB

The following table summarizes the DIP Switch settings for different
configurations of ESA86/88E Trainer.

DIPSwitch Functionality
No Configuration Remarks

Baud Rate ESA 86/88 E


1 -3 Please communicates at a
Setting for
refer max. Baud rate of
RS 232 C
Section 19200 with the
Communicat
2.3.1 Windows Driver
ion.
package.
ON:SerialMode
Operational OFF:Stand-lone
4
Mode Mode*
Printer Driver ON : Enabled For Serial
5 Enable OFF : mode only
Disabled* (refer chapter
6)
6 - - Reserved

CPU ON :8086* Both CPUs Operate


7
Selection OFF :8088 at 5MHz in
maximum mode.
8 - - Reserved

CPUSELECTION

ESA 86/88E can be operated either with an 8086 or an 8088 CPU operating at a
frequency of
[Link](8086or8088)inthesocketlabeledU22andselectSW7of
the DIPSwitchaccordingly.

OPERATINGMODE

Instand-
[Link]
e,
thetrainercanbeconnectedtoaCRTterminalortoahostcomputersystemthroughRS
232C communicationstandardinterface.

Baud rate selection

ELECTRONICS AND COMMUNICATION ENGINEERING Page 6


UCE, AKNU MICROPROCESSOR AND MICROCONTROLLER LAB

ESA86/88Euses8251AUSARTfor serial communication(RS-232-


C).Inserialmodeofoperation. The following initializations are made by system
firmware.
 Asynchronousmode
 8-bit characterlength
 2 Stopbits
 Noparity
 Baudratefactorof16x
Timer0ofon-
[Link]
system firmware initializes the timer for proper Baud clock based on DIP Switch
settings as described below.

DIP SW1 DIP SW2 DIP SW3 Baud Rate


ON ON ON 110
ON ON OFF 300
ON OFF ON 600
ON OFF OFF 1200
OFF ON ON 2400
OFF ON OFF 4800
OFF OFF ON 9600*
OFF OFF OFF 19200

(* Factory installed option)

INSTALLATIONOFESA86/88E

To install and operate ESA 86/8 E trainer, the following accessories are required

 Powersupply : +5V @ 1A(max)


 For Serial Mode of Operation : CRT terminal/PC Compatible
HostComputersystemwithRS232Cinterface,driversoftware andRS-232-
CcompatibleSerialCables.
 ForStand-aloneoperation : PS/2 compatible PCKeyboard.

The following steps are common for either mode of operation with ESA 86/88E
Trainer.

1. SelecttheCPU(8086or8088)andModeofOperationusingtheDIPSwitch.
2. Select EPROM configuration if necessary(Ref.Section2.5).

ELECTRONICS AND COMMUNICATION ENGINEERING Page 7


UCE, AKNU MICROPROCESSOR AND MICROCONTROLLER LAB

3. Install8087NDPifdesired(RefSection2.4).
4. ConnectthePowerSupplyofrequiredcapacitytoESA86/88E.
Serial Mode Operation:
1. Select mode of operation,Baudrate andEnable/DisablePrinterDriverbysettingthe
DIPSwitch.
2. Connect ESA 86/88 E to Host PC/CRT through an RS-232-C cable.
Interfacing requirementsforRS-232-CcommunicationaredescribedinAppendixE.
3. Theterminal/computersystemshouldbepoweredONandthedriversoftwareshould
berunning Refer Chapter 3 for details of installation of Driver Software and
Communicationprocedures

Now the following sign-on message should appear on the console depending on the
CPU installed.

ESA 86E MONITOR VX.Y or ESA 88E MONITOR VXY

(V x.y indicates Version x and Revision y)

Thesign-
onmessageisfollowedbythecommandprompt,“.”inthenextline.
ThefollowingmessageappearsontheLCDdisplay

ESA86MONITORVx.y
SER:9600 P :86

Stand -alone mode operation:

1. ConfigurethetrainerusingDIPSwitchandjumperasdescribedintheearliersection
s.
2. Installthe20x4LCDandconnectaPCKeyboardtothePS/2orDINconnectorprovi
ded.
3. ConnectthepowersupplyofrequiredcapacitytoESA86/8EandPowerONthetra
iner.

Now if 8086 is installed, the following sign-on message will appear on the LCD.
Thesign-on
messageisfollowedbythecommandprompt,“.”andthcursor“_”inthenextline.Incaseof8
088 CPUthesignonmessagewillchangeaccordingly.

ESA86MONITORVx.y

KBD P:86

ELECTRONICS AND COMMUNICATION ENGINEERING Page 8


UCE, AKNU MICROPROCESSOR AND MICROCONTROLLER LAB

EXECUTION PROCEDURE FOR 8086

Writing an alp program into 8086: Check the supply(+5v) and connect to JI,
Keyboard to J11

Switch on kit

Press reset

Press A (give starting address)

Press enter

Enter 1st mnemonic


Press enter

Enter 2nd mnemonic

Press enter
---
---
---
Enter nth mnemonic

Press enter

To compile:
Press G (give starting address)

Press enter

Display: program executed

Result: AX= ------


BX= ------
----------
For values to particular address location
Press S(Address location)

ELECTRONICS AND COMMUNICATION ENGINEERING Page 9


UCE, AKNU MICROPROCESSOR AND MICROCONTROLLER LAB

PART- A: 8086 Assembly Language Programming


Exp No.1: Programs for 16bit arithmetic operations for 8086
A) Addition:
i) 16-bit addition:

AIM: -To write an assembly language program for Addition of two 16-bit numbers.

APPARATUS:

1. 8086 Microprocessor Kit----1


2. RPS (+5V) ----1

ALGORITHM:-

1. Start theProgram.
2. Initialize the contents of memory locations in AX & BXregisters.
3. Add the value of AX and BX by using ADD Mnemonic and store the
result in a memory location.
4. Stop theProgram.

PROGRAM:

MEMORY LOCATION MNEMONIC


2000 MOV AX, 11
2003 MOV BX, 22
2006 ADD AX,BX
2008 INT 03

OUTPUT:

Input output

Register Data Register Data

AX 11H AX 33H

BX 22H

ELECTRONICS AND COMMUNICATION ENGINEERING Page 10


UCE, AKNU MICROPROCESSOR AND MICROCONTROLLER LAB

ii) Multi byte addition

AIM:-Program to perform multi byte addition

APPARATUS:
1. 8086 Microprocessor Kit -----1
2. RPS(+5V) -------------------1
ALGORITHM:-
1. Start the Program.
2. Load 0000H into AX register.
3. Load the data intoSI from memory 2000.
4. Load the data into BX register from memory 2004.
5. Add BX with AL
6. Increment SI, BX, DI
7. Repeat step 4&5
8. Stop the Program.

PROGRAM:

MEMORY LOCATION MNEMONIC

4000 MOV AX,0000


4003 MOV SI, 2000

4006 MOV DI, 3000


4009 MOV BX, 2004
400C MOV CL, 04
400E MOV AL, [SI]
4010 ADD AL, [BX]
4012 MOV [DI], AL

4014 INC SI
4015 INC BX
4016 INC DI
4017 DEC CL
4019 JNZ 400E
401B INT 03

ELECTRONICS AND COMMUNICATION ENGINEERING Page 11


UCE, AKNU MICROPROCESSOR AND MICROCONTROLLER LAB

OUTPUT:

INPUT OUTPUT

Memory Memory Memory


Data Data Data
Location Location Location

2000 01H 2004 23H 3000 24H

2001 02H 2005 27H 3001 29H

2002 07H 2006 10H 3002 17H

2003 08H 2007 14H 3003 1CH

B) Subtraction:
i)16 bit subtraction:
AIM: - To write an assembly language program for subtraction of two 16-bit
numbers.

APPARATUS: 1. 8086 microprocessor kit ----1


[Link] (+5V) ----1
ALGORITHM:-

1. Start theProgram
2. Initialize the contents of memory locations in AX & BXregisters
3. Subtract the value of AX and BX by using SUB Mnemonics and store the
result in a memory location.
4. Stop theProgram.
PROGRAM:

MEMORY
LOCATION INSTRUCTION
4000 MOV AX, 34
4003 MOV BX, 12
4006 SUB AX,BX
4008 INT 03

ELECTRONICS AND COMMUNICATION ENGINEERING Page 12


UCE, AKNU MICROPROCESSOR AND MICROCONTROLLER LAB

OUTPUT :

INPUT OUTPUT

Regist
Data Register Data
er
AX 34H AX 22H

BX 12H

ii) Multi byte subtraction


AIM:-Program to perform multi byte subtraction

APPARATUS: 1. 8086 microprocessor kit ----1


2. RPS (+5V) ----1
ALGORITHM:-
1. Start the Program.
2. Load 0000H into AX register.
3. Load the data into SI from memory 2000.
4. Load the data into BX register from memory 2004.
5. Subtract BX with AL
6. Increment SI, BX, DI
7. Repeat step 4&5
8. Stop the Program

PROGRAM:

MEMORY LOCATION MNEMONIC

4000 MOV AX,0000


4003 MOV SI, 2000
4006 MOV DI, 3000
4009 MOV BX, 2004
400C MOV CL, 04
400E MOV AL, [SI]

4010 SUB AL, [BX]


4012 MOV [DI], AL

ELECTRONICS AND COMMUNICATION ENGINEERING Page 13


UCE, AKNU MICROPROCESSOR AND MICROCONTROLLER LAB

4014 INC SI
4015 INC BX
4016 INC DI
4017 DEC CL
4019 JNZ 400E

401B INT 3

OUTPUT:

INPUT OUTPUT

Memory Memory Memory


Location Data Location Data Location Data

2000 23H 2004 02H 3000 21H

2001 27H 2005 04H 3001 23H

2002 44H 2006 01H 3002 43H

2003 43H 2007 03H 3003 40H

ELECTRONICS AND COMMUNICATION ENGINEERING Page 14


UCE, AKNU MICROPROCESSOR AND MICROCONTROLLER LAB

EXP NO.2: Program for 16-bit Multiplication & Division in 8086 using kit
i)16 bit multiplication:
AIM: -To write an assembly language program for multiplication of two 16-bit
numbers.
APPARATUS: 1. 8086 microprocessor kit ----1
2. RPS (+5V) ----1
ALGORITHM:-

1. Start the Program


2. Initialize the contents of memory locations in AX & BX registers
3. Multiple the value of AX and BX by using MUL Mnemonics and store the
result in a memory location.

4. Stop the Program

PROGRAM:

MEMORY
LOCATION MNEMONIC

4000 MOV AX,02


4003 MOV BX,03
4006 MUL BX
4008 INT 03

OUTPUT

OUTPUT
INPUT
Register Data Register Data

AX 02H AX 06H

BX 03H

ELECTRONICS AND COMMUNICATION ENGINEERING Page 15


UCE, AKNU MICROPROCESSOR AND MICROCONTROLLER LAB

ii) 16bit division:

AIM: - To write an assembly language program for division of two 16-bit numbers.

APPARATUS: 1. 8086 microprocessor kit ----1


2. RPS (+5V) ----1
ALGORITHM:-

1. Start the Program


2. Initialize the contents of memory locations in AX & BX registers
3. Subtract the value of AX and BX by using SUB Mnemonics and store the
result in a memory location.
4. Stop the Program

PROGRAM:

MEMORY
LOCATION MNEMONIC

4000 MOV AX,08


MOV BX,02
DIV BX
INT 3

OUTPUT:

INPUT OUTPUT

Register Data Register Data

AX 0008H AX 0004H

BX 0002H DX

ELECTRONICS AND COMMUNICATION ENGINEERING Page 16


UCE, AKNU MICROPROCESSOR AND MICROCONTROLLER LAB

EXP NO.3: Program for sorting an array for 8086.


i) ASCENDING ORDER

AIM:-Program to sort the given numbers in ascending order

APPARATUS: 1. 8086 microprocessor kit ----1


2. RPS (+5V) ----1
ALGORITHM:-

1. Start the Program

2. Load data from offset 2000 to register CL(for count)

3. Travel from starting location to last and compare two numbers if first

number is greater than second number then swap them


4. First pass fix the position for last number.

5. Decrease the count by 1

6. Again travel from starting memory location to(last-1,by help of count)

and compare two numbers if first number is greater than second number
then swap them
7. Second pass fix the position for last two numbers.

8. Repeat

9. Stop the program

ELECTRONICS AND COMMUNICATION ENGINEERING Page 17


UCE, AKNU MICROPROCESSOR AND MICROCONTROLLER LAB

PROGRAM:

MEMORY LOCATION MNEMONIC


4000 MOV AX, 0000H
4003 MOV CH, 0004H
4005 DEC CH
4007 MOV CL, CH
4009 MOV SI,2000
400C MOV AL,[SI]
400E INC SI
400F CMP AL,[SI]
4011 JC 4019
4013 XCHG AL,[SI]
4015 DEC SI
4016 MOV [SI],AL
4018 INC SI
4019 DEC CL
401B JNZ 400C
4010 DEC CH
401F JNZ 4007
4020 INT 03

OUTPUT:

INPUT OUTPUT

Memory Memory
Data Data
Location Location

2000 03H 2000 03H

2001 06H 2001 04H

2002 07H 2002 06H

2003 04H 2003 07H

ELECTRONICS AND COMMUNICATION ENGINEERING Page 18


UCE, AKNU MICROPROCESSOR AND MICROCONTROLLER LAB

ii) DESCENDING ORDER

AIM:-Program to sort the given numbers in descending order

APPARATUS: 1. 8086 microprocessor kit ----1


2. RPS (+5V) ----1
ALGORITHM:-

1. Start the Program

2. Load data from offset 2000 to register CL(for count)

3. Travel from starting location to last and compare two numbers if first

number is smaller than second number then swap them


4. First pass fix the position for last number.

5. Decrease the count by 1.

6. Again travel from starting memory location to(last-1,by help of count) and

compare two numbers if first number is smaller than second number then
swap them.
7. Second pass fix the position for last two numbers.

8. Repeat.

9. Stop the program.

ELECTRONICS AND COMMUNICATION ENGINEERING Page 19


UCE, AKNU MICROPROCESSOR AND MICROCONTROLLER LAB

PROGRAM:
MEMORY LOCATION MNEMONIC
4000 MOV AX, 0000

4003 MOV CH, 0004

4005 DEC CH

4007 MOV CL,CH

4009 MOV SI,2000

400C MOV AL,[SI]

400E INC SI

400F CMP AL,[SI]

4011 JNC 4019

4013 XCHG AL,[SI]

4015 DEC SI

4016 MOV [SI],AL

4018 INC SI

4019 DEC CL

401B JNZ 400C

4010 DEC CH

401F JNZ 4007

4020 INT 3

OUTPUT:

INPUT OUTPUT

Memory Memory
Data Data
Location Location

2000 03H 2000 07H

2001 06H 2001 06H

2002 07H 2002 04H

2003 04H 2003 03H

ELECTRONICS AND COMMUNICATION ENGINEERING Page 20


UCE, AKNU MICROPROCESSOR AND MICROCONTROLLER LAB

EXP NO: 4
Program to determine squares of n numbers by using 8086 microprocessor kit
AIM: Write a program in 8086 microprocessor to find out the squares of 8-bit
n numbers.

APPARATUS: 1. 8086 microprocessor kit ----1


2. RPS (+5V) ----1

ALGORITHM :

1. Store 3000 to SI and Load data from address 3000 to register CL and set register
CH to 00 (for count).
2. Increase the value of SI by 1.
3. Load first number (value) from next address (i.e. 3001) to register AL.
4. Multiply the value in register AL by itself.
5. Store the result (value of register AL ) to memory address SI.
6. Increase the value of SI by 1.
7. Loop above 2 till register CX gets 0.

PROGRAM:

MEMORY LOCATION MNEMONIC

2000
MOV SI, 3000H
2003
MOV CL, [SI]
2005
MOV CH,00H
2007
INC SI
2008
MOV AL,[SI]
200A
MUL AL
200C
MOV [SI],AL
200E
INC SI
200F
LOOP 2008
2011
INT 03

ELECTRONICS AND COMMUNICATION ENGINEERING Page 21


UCE, AKNU MICROPROCESSOR AND MICROCONTROLLER LAB

OUTPUT:

Input Output

MEMORY Data MEMORY Data


LOCATION LOCATION

3000 04H 3001 09H

3001 03H 3002 01H

3002 01H 3003 04H

3003 02H

ELECTRONICS AND COMMUNICATION ENGINEERING Page 22


UCE, AKNU MICROPROCESSOR AND MICROCONTROLLER LAB

EXP NO:5 Program to determine cubes of n numbers by using 8086


microprocessor kit

AIM: Write a program in 8086 microprocessor to find out the cubes of 8-bit
n numbers.

APPARATUS: 1. 8086 microprocessor kit ----1


2. RPS (+5V) ----1

ALGORITHM :
1. Store 5000 to SI and Load data from 5000 to register CL and set register CH to
00 (for count).
2. Increase the value of SI by 1.
3. Load number (value) from SI to register AL.
4. Move the value of register AL to BL.
5. Multiply the value in register AL by itself.
6. Multiply the value in register AL by BL.
7. Store the result (value of register AL ) to memory SI.
8. Increase the value of SI by 1.
9. Loop above 6 till register CX gets 0.

PROGRAM:

MEMORY LOCATION MNEMONIC

2000
MOV SI, 5000
2003
MOV CL, [SI]
2005
MOV CH,00H
2007
INC SI
2008
MOV AL,[SI]
200A
MOV BL, AL
200C
MUL AL
200E
MUL BL
2010
MOV [SI],AL
2012
INC SI
2013
LOOP 2008
2015
INT 03

ELECTRONICS AND COMMUNICATION ENGINEERING Page 23


UCE, AKNU MICROPROCESSOR AND MICROCONTROLLER LAB

OUTPUT:

Input Output

Memory location Data Memory location Data

5000 04 5001 1B

5001 03 5002 01

5002 01 5003 08

5003 02 5004 7D

5004 05

ELECTRONICS AND COMMUNICATION ENGINEERING Page 24


UCE, AKNU MICROPROCESSOR AND MICROCONTROLLER LAB

EXP NO:6 Program to find the factorial of a given number by using


8086 microprocessor kit

AIM: Write a program in 8086 microprocessor to find out the factorial of a


givennumber.

APPARATUS: 1. 8086 microprocessor kit ----1


2. RPS (+5V) ----1

ALGORITHM :
1. Initialize segment
2. Registers
3. Load values from memory
4. Save value and substitute
5. Multiplication
6. Store computed value in memory
7. Stop Execution

PROGRAM:

MEMORY LOCATION MNEMONIC

2000
MOV AX, 0000
2003
MOV CS, AX
2005
MOV DS, AX
2007
MOV SI, 3000
200A
MOV AL, [SI]]
200C
MOV BL, [SI]
200E
DECBL
2010
JZ 2018
2012
MOV [SI], BL
2014
MULW [SI]
2016
JMP 200C
2018
MOV DI,3100
201B
MOV [DI],AX
201D INT 03

ELECTRONICS AND COMMUNICATION ENGINEERING Page 25


UCE, AKNU MICROPROCESSOR AND MICROCONTROLLER LAB

OUTPUT:

Input Output

Memory location Data Memory location Data

3000 04 3100 18

3000 06 3100 D0

ELECTRONICS AND COMMUNICATION ENGINEERING Page 26


UCE, AKNU MICROPROCESSOR AND MICROCONTROLLER LAB

EXP NO:7 Program to add two 8 bit BCD numbers


AIM:Write a program in 8086 microprocessor to find out the addition of two 8-bit
BCD numbers

APPARATUS: 1. 8086 microprocessor kit ----1


2. RPS (+5V) ----1

ALGORITHM :
1. Load data from 3000 to register AL (first number)
2. Load data from 3001 to register BL (second number)
3. Add these two numbers (contents of register AL and register BL)
4. Apply DAA instruction (decimal adjust)
5. Store the result (content of register AL) to 4000
6. Set register AL to 00
7. Add contents of register AL to itself with carry
8. Store the result (content of register AL) to 4001
9. Stop

PROGRAM:

MEMORY LOCATION MNEMONIC

2000
MOV SI, 3000
2003
MOV AL, [SI]
2005
MOV SI, 3001
2007
MOV BL, [SI]
2008
ADD AL, BL
200A
DAA
200B
MOV DI, 4000
200D
MOV [DI], AL
200F
MOV AL, 00
2011
ADC AL, AL
2012
MOV DI, 4001
2015
MOV [DI], AL
2017
INT 03

ELECTRONICS AND COMMUNICATION ENGINEERING Page 27


UCE, AKNU MICROPROCESSOR AND MICROCONTROLLER LAB

OUTPUT:
Input Output

Memory location Data Memory location Data

3000 35 4000 07

3000 72 4001 01

Viva:

1. How many bit 8086 microprocessor is?

2. What is the size of data bus of 8086?

3. What is the size of address bus of 8086?

4. What is the max memory addressing capacity of 8086?

5. Which are the basic parts of 8086?

6. What is the size of instruction queue in 8086?

7. Which are the registers present in 8086?

8. What do you mean by pipelining in 8086?

9. How many 16 bit registers are available in 8086?

10. Specify addressing modes for any instruction?

11. What do you mean by assembler directives?

12. What model small stands for?

13. What is the supply requirement of 8086?

14. What is the relation between 8086 processor frequency & crystal Frequency?

15. Functions of Accumulator or AX register?

ELECTRONICS AND COMMUNICATION ENGINEERING Page 28


UCE, AKNU MICROPROCESSOR AND MICROCONTROLLER LAB

PART- B: 8086 interfacing

EXP NO:1
INTERFACING OF 8259 WITH 8086
AIM: - To the operation of 8259 peripheral interfacing to the 8086 microprocessor.
HARDWARE USED: - 8259 peripheral kit
SOFTWARE USED: -WIN 86E ESA trainer.
THEORY: -
The architecture block diagram of 8259 is shown the functional operation of each block
is given as
INTERRUPT REQUEST REGISTER (IRR):-
The interrupts of IRR I/p lines are handled by interrupt request register internally. It
stores all the interrupt request.
IN SERVICE REGISTER (ISR): -
This stores all the interrupt request those are being served i.e. ISR. Keeps a track of
request being served?
PRIORITY RESOLVER: -
This determiner the priorities of interrupt request appearing simultaneously. The highest
priority and corresponding bit of ISR during INTA.
INTERRUPT MASK REGISTER: -
The register stores the bits required to mask the interrupt I/p.
INTERRUPT CONTROL LOGIC: -
This is used to manage the interrupt and acknowledge signal to be sent to CPU.
CASCADE BUFFER/COMPARATOR: -
This block stores and compares ID’S of 8259’s used in the system. The 8259 contains two
types of command words.
(i) Initialization command words(ICW’S)
(ii) Operation command words (OCW’S)

INITIALIZATION COMMAND: -
ICW1:
Before it starts functioning must be initialized by 2 or 4 command words irrespective
command word register. If A0=1,P4=1,then ICW is recognized as ICW1 it contains edge (or) level
triggered mode, single (or) cascade mode call address interval.
ICW2:
If 10=1 the control word is recognized as ICW2, It stored details regarding interrupt vector
address.
ICW3:
It indicates whether it is in master or slave mode.
ICW4:
IC4 this command word depends on IC4 bit of ICW1,IC4is 0 in [Link] need not to go
for ICW4.
The bit function ICW4 is described mode.
SFNM: Especially fully nested mode.
BUF: Buffer mode.
M/S: Master or slave mode.
AEOI: Automatic end of interrupts.
OPERATIONAL COMMAND WORDS: -

ELECTRONICS AND COMMUNICATION ENGINEERING Page 29


UCE, AKNU MICROPROCESSOR AND MICROCONTROLLER LAB

The operating command words divided into 3 types every bit corresponding to
some other features of mode selected except for a few bits gather 1 or 0 twice OCW’s are.

OCW1:The OCW1 is used to mask the interrupt register mask bits is 1 corresponding interrupt
priority is ‘0’.
OCW2: In this OCW2 contains 3 bits R, XZ, EOI content.
OCW3: In OCW3 is the ESMM enable specially masked mode bit is set to 1 and SMM bit is
enable to selected. If ESMM=1, SMM=0 then [Link] return the normal mask operation, the
reaming bits will decide the pole operation D), D1 acts as read||R RD pulse.

PROCEDURE: -
1. 230V power supply is connected and 5V regulated DC is supplied to 8086.
2. RS 232 port is connected to PC trainer kit
3. This 8086 trainer kit consists of 8 switches. First 3 switches are for band rate or key board.
And 4 switches (5,6,7,8) and are for getting the O/P priority i.e 0100 is set
4. The peripherals are connected to 8086 using buses.
5. Every program is calculated in different communication modes so that we can select the
mode for executing the program.
6. To know the communication modes we have to go propertieshard waredevice
managerports.
7. In ports the required communication mode is shown as COM1 to COM9. In that it shown
are COM.
8. In system, we go to startprogramESA trainerWIN86E.
9. When we open WIN86E it will also ask whether to change mode in that we change it as
required.
10. The press CMD, then press rest 8086 trainer kit.
11. In this we type at the command. Linear as Z 2000 ending address.
12. And the ending address is any values as assume then the code displaying on monitor for
viewing output.
13. Set theI/P terminal on 8259 for display of interrupt msg.
14. By applying an external trigger button, we get the O/P & the generated interrupt is
displayed on command window.

PROGRAM TO SERVICE ALL INTERRUPTS GENERATED BY 8086


ADDRESS OPCODE LABELS MNEMONICS COMMENTS
ORG 2000H
0000:2000 B8 00 00 MOV AX,0000H
0000:2003 8E C8 MOV CS,AX
0000:2005 8E C0 MOV ES,AX
0000:2007 8E DO MOV SS,AX
0000:2009 BC C0 30 MOV SP,3000H
0000:200C BE 20 01 MOV S1,0120H Into vector address
0000:200F B8 00 22 MOV AX,2200H 0120 is the base
0000:2012 89 04 MOV[S1],AX of INT vector table
0000:2014 83 06 02 ADD S1,02H
0000:2017 B8 00 00 MOV AX,0000H
0000:201A 89 04 MOV[S1],AX

ELECTRONICS AND COMMUNICATION ENGINEERING Page 30


UCE, AKNU MICROPROCESSOR AND MICROCONTROLLER LAB

0000:201C 83 C0 02 ADD S1,02H INT1 vector address

0000:201F B8 10 22 MOV AX,2210H


0000:2022 89 04 MOV [S1],AX
0000:2024 83 C6 02 ADD S1,02H
0000:2027 B8 00 00 MOV AX,0000H
0000:202A 89 04 MOV[S1],AX
0000:202C 83 C6 02 ADD S1,02H INT2 vector address
0000:202F B8 20 22 MOV AX,2220H
0000:2032 89 04 MOV[S1],AX
0000:2034 83C6 02 ADD S1,02H
0000:2037 B8 00 00 MOV AX,0000H
0000:203A 89 04 MOV [S1],AX
0000:203C 83 C6 02 ADD S1,02H INT3 vector address
0000:203F B8 30 22 MOV AX,2230H
0000:2042 89 04 MOV[S1],AX
0000:2044 83 C6 02 ADD S1,02H
0000:2047 B8 00 00 MOV AX,0000H
0000:204A 89 04 MOV[S1],AX
0000:204C 83 C6 02 ADD S1,02H INT4 vector address

0000:204F B8 40 22 MOV AX,2240H


0000:2052 89 04 MOV [S1],02H
0000:2054 83 C6 02 ADD S1,02H
0000:2057 B8 00 00 MOV AX,0000H
0000:205A 89 04 MOV[S1],AX
0000:205C 83 C6 02 ADD S1,02H INT5 vector address
0000:205F B8 50 22 MOV AX,2250H
0000:2062 89 04 MOV[S1],AX
0000:2064 83 C6 02 ADD S1,02H
0000:2067 B8 00 00 MOV AX,0000H
0000:206A 89 04 MOV [S1],AX
0000:206C 83 C6 02 ADD S1,02H INT6 vector address
0000:206F B8 60 22 MOV AX,2260H
0000:2072 89 04 MOV [S1],AX
0000:2074 83 C6 02 ADD S1,02H
0000:2077 B8 00 00 MOV AX,0000H
0000:207A 89 04 MOV [S1],AX
0000:207C 83 C6 02 ADD S1,02H INT7 vector address
0000:207F B8 70 22 MOV AX,2260H
0000:2082 89 04 MOV[S1],AX
0000:2084 83 C6 02 ADD S1,02H
0000:2087 B8 00 00 MOV AX,0000H
0000:208A 89 04 MOV [S1],AX 8259 initialization
0000:208C BA C8 FF MOV DX,OFFC8H
0000:208f b0 17 mov al,17h icw1(ic4needed,single,internal 4,
edge trigint)
0000:2091 Ee out dx,al internal4,edgetrigint
0000:2092 bacaff mov dx, offcah icw2(multiple for int vector
address table)for making 120h
0000:2095 bo 48 mov al,048h

ELECTRONICS AND COMMUNICATION ENGINEERING Page 31


UCE, AKNU MICROPROCESSOR AND MICROCONTROLLER LAB

0000:2097 Ee out dx,al as base address of int vector table


0000:2098 bo 03 mov al,03h icw4 (8086 mode autoeoj)
0000:209a Ee out dx, al
0000:209b bo 00 mov al,00h ocw4(enable all interrupts)
0000:209d Ee out dx,al
0000:209e Fb sti
0000:209f e9 fdff here: jump here
0000:2100 20 20 0a msgo: db 20h,20h,0ah,’int
49
0000:2106 30 20 4f 43
0000:210c 52 45 44
0a 0d
0000:2111 20 20 0a msgi: db 20h, 20h,0ah’int’
49
0000:2117 31 20 4f 43
43 55
0000:211d 52 45 44
0a 0d
0000:2122 20 20 0a msg2: db 20h,20h,0ah’int2
49 4e 54 occurred’ 0ah,odh
0000:2128 32 20 4f 43
43 55
0000:212e 52 45 44
0a 0d
0000:2133 20 20 0a msgb: db 20h,0ah’int3
49 4e 54 occurred’ 0ah, 0dh
0000:2139 33 20 4f 43
43 55
0000:213f 52 45 44
0a 0d
0000:2144 20 20 0a msg4: db 20h,20h,0ah, ‘int4
49 4e 54 occurred’,0ah,0dh
0000:214a 34 20 4f 43
43 55
0000:2150 52 45 44
0a 0d
0000:2155 20 20 0a msg5: db 20h, 20h,0ah,’int5
49 4e 54 occurred’, oah,0dh
0000:215b 35 20 4f 43
43 55
0000:2166 20 20 0a msg6: db 20h,20h,0ah’int6
49 4e 54 occured’,0ah,0dh
0000:2161 52 45 44
0a 0d
0000:216c 36 20 4f 43
43 55
0000:2172 52 45 43
43 55
0000:2177 20 20 0a msg7: db 20h,20h,0ah,0dh
49 4e 54
0000:217d 37 20 4f 43
43 55

ELECTRONICS AND COMMUNICATION ENGINEERING Page 32


UCE, AKNU MICROPROCESSOR AND MICROCONTROLLER LAB

0000:2183 52 45 44 org 2200h int 0 is


0a 0d
0000:2200 Fa cli
0000:2201 2e 8d 16 lea dx,msgo
00 21
0000:2206 e9 f7 00 jmpdisp
0000:2209 Cc nit 03
0000:2210 fa cli
0000:2211 2e 80 16 lea dx, msg1
11 21
0000:2216 e9 f7 00 jmpdisp
0000:2219 Cc int 03
0000:2220 Fa cli
0000:2221 2e 8d 16 lea dx, msg2
22 21
0000:2226 e9 07 00 jmpdisp
0000:2229 Cc Int 03 org 22 30h Int3 isr
0000:2230 Fa cil
0000:2231 2e 8d 16 Lea dx,msg3
33 21
0000:2236 E9 c7 00 Jmpdisp
0000:2239 Cc Int 03
0000:2240 Fa Org 22 40h cil Int4 isr
0000:2241 2e 8d 16 Lea dx,mag4
44 21
0000:2246 E9 b7 00 Jmpdisp
0000:2249 Cc Int 03
0000:2250 Fa Org 2250h cli Int5 isr
0000:2251 2e 8d 16 Lea dx, msg5
55 21
0000:2256 E9 97 00 Jmpdisp
0000:2259 Cc Int 03
0000:2260 Fa cli
0000:2261 2d bd 16 Lea dx, msg6
66 21
0000:2266 E9 97 00 Jmpdisp
0000:2269 Cc int 03 org 2270h Int7 isr
0000:2270 Fa cli
0000:2271 2e 8d 16 Lea dx,msg7
77 21
0000:2276 E9 87 00 Jmpdisp
0000:2279 Cc Int 03 org 2300h Common display routine
0000:2300 8b f2 Disp: Movsi, dx For all isr’s
0000:2302 B9 11 00 Mov cx, 011h
0000:2305 8a 04 L1: Mov al,[si]
0000:2307 9a 00 00 Call routine to
00 fe
0000:230c 46 Incsi Display the msgs
0000:230d E2 f6 Loop l1
0000:230f Fb sti
0000:2310 Cf iret Return from interrupt

ELECTRONICS AND COMMUNICATION ENGINEERING Page 33


UCE, AKNU MICROPROCESSOR AND MICROCONTROLLER LAB

[Link]: 2
INTERFACING OF 8255 WITH 8086

AIM: To study the operation of 8255 peripheral connected with 8086 microprocessor

HARD WARE USED: 8255 kit programmable peripheral interface.


SOFT WARE USED: win 86E ESA trainer kit.

THEORY:
The parallel input-output port chip 8255 is also known as programmablePeripheral input-output
port. It has 24 input-output lines which may be programmed into two groups of twelve lines the
groups are named as a group a and group B. group A contains an 8- bit part A long with a4- bit
part. the part A lines are identified by the symbols [Link] the port C lines are identified
by PC4_PC7.similarly group B,C lower (PC0-PC3) all of these parts and function independently
either as input and output port these can be achieved by programming the bits of an internal
register of 8255 called as control word register. The bit data bus buffer is controlled by read/write
control logic. Bar RD, WR, A1, A0 reset the input provided by the microprocessor to read/write
control logic. In this programmable I/O ports to control word register they areBitset(or) reset mod
Input/output mode

BSR MODE:
In this mode any one, of the 8- bit of port C can be set or reset depending on the D0 of the CWR
INPUT/OUTPUT MODE:
Depending on the D5, D6 bits of CWR. In this 3 modes are present
I) mode 0  Basic I/O mode
II) Mode 1  hand shaking and signal or strobe.
III) Mode2 bidirectional strobe.
All those modes can be selected by programming a register internal to 8255, known as a control
word register (CWR)

PROCEDURE:
1. Connect regular power supply to the 8086 kit.
2. Plug out the key board from pc and connect it to the 8086 kit.
3. Connect the 8255 with the 8086 kit using two parallel ATA cables.
4. Switch on the computer and click on the software ‘ESA 86E”.
5. Before continuing go to device manager and check the usb ports, whether the comport is
enabled, else re-connect it.
6. Go to file and click on an 8255 file. The program modes”BSR mode” and “i/o mode” are
available.
7. Click on any one of the mode and open the file
8. Observe the download programs and determine the end address.
9. Click on the command mode and press the reset button and type Z 2000

ELECTRONICS AND COMMUNICATION ENGINEERING Page 34


UCE, AKNU MICROPROCESSOR AND MICROCONTROLLER LAB

10. Enter g 2000 and the program is dumped into 8255 where the required O/P is observed

PROGRAM FOR BSR MODE:


ADDRESS OP-CODE LABEL MNEMONICS COMMENTS
0000:2000 Bo 80 Mov al,80 Initialize 8255

0000:2002 BA C6 FF Mov DX,FFC6


0000:2005 EE Out dx,al PORT A,B&C AS
O/P

0000:2006 Bo of Rpt: Moval,of


0000:2008 BA CC FF MOV DX,FF C6 SET PC7 USING
BIT SET/RESET
MODE.
0000:200b EE OUT DX,AL
0000:200c F8 0B 00 CALL DELAY
0000:200f BO OE MOV AL,OE
0000:2011 BA C6 FF MOV DX,FFC6 RESET PC7.
0000:2014 Ee Out dx,al
0000:2015 E8 02 00 Call delay
0000:2018 E2 ec Loop rpt
0000:201a 50 delay Push ax Delay routine

0000:201b 51 Push cx
0000:201C B9 30 00 MOV CX,0030
0000:201F B8 FF OF 201F: MOV AX,0FFF
0000:2022 48 2022: DEC AX
0000:2023 75 FD JNE 2022
0000:2025 E2 F8 IOOP 201F
0000:2027 59 POP CX
0000:2028 58 POP AX
0000:2029 C3 RET

ELECTRONICS AND COMMUNICATION ENGINEERING Page 35


UCE, AKNU MICROPROCESSOR AND MICROCONTROLLER LAB

PROGRAM FOR 8255 IN MODE 2:

ADDRESS OP-CODE LABEL MNEMONICS COMMENTS


Org 2000 Initialize
0000:2000 BO CO INIT MOV AL,DO PORT A IN
MODE2
0000:2002 BA C6 FF MOV DX,FFC6
0000:2005 EE OUT DX,AL
0000:2006 BA CO FF MOV DX,FFCO
0000:2009 EE IN AL,DX TAKING DATA
FROM PORT A
0000:200A BA C2 FF MOV DX,FFC2 SENDING
PORT A DATA
TO PORT B
0000:200E BO 55 MOV AL,55 MOVING 55 TO
THE AL
REGISTER
AND SENDING
IT TO THE
PORTA.
0000:2010 BA CO FF MOV DX, FFCO
0000:2013 EE OUT DX,AL
0000:2014 E9 F2 FF JMP 2009

RESULT :Hence studied the operation of 8255 interfacing the program using win 86e ESA
trainer.

ELECTRONICS AND COMMUNICATION ENGINEERING Page 36


UCE, AKNU MICROPROCESSOR AND MICROCONTROLLER LAB

[Link]
INTERFACING OF 8279 WITH 8086

AIM: To study the operation of Interfacing of 8279 peripherals with 8086 microprocessors.

HARD WARE USED: 8279 kit programmable peripheral interface with 8086 kit.
SOFT WARE USED: win 86E ESA trainer kit.

THEORY:The8279 is a general purpose keyboard display controller that simultaneously drives


the display of a system and interfaces a keyboard with the CPU, leaving it free for its routine task.
The keyboard display interface scans the keyboard to identify if any key has been pressed and
sends the code of the pressed key to the CPU. It also transmits the data received from the CPU, to
the display device. Both of these functions are performed by the controller in the repetitive fashion
without involving the CPU.
The key board is interfaced either in the interrupt or the polled mode. In
the interrupt mode the processor is requested service only if any key is pressed otherwise the CPU
will proceed with its main task. In the polled mode, the CPU periodically reads an internal flag of
8279 to check for a key pressure.

PROCEDURE:
DECODING METHOD: “-ESA PVT LED”
i) Connect regulated power supply to 8086 kit.
ii) Connect the 8279 with the 8086 kit using two parallel ATA cables & Switch on the
regulated power supply.
iii) Now, turn on the pc, open’s 86e’ trainer software.
iv) Before click on the 8279 modes, click on device manager and check out the USB serial
ports whether or gained or not.
v) Click on file and open the 8279 folder and Browse the decoding method hex file.
vi) Observe download program and check starting and ending address.
vii) Click on the command window.

In the command window, enter “z start address, end address


viii) Observe the compiled program on the screen and enter “g start address” for execution.
ix) You can observe the output on the seven segment display when you have clicked on
any key in 8279 keypad.

ENCODING METHOD: “ELECTRO SYSTEMS INDIA - .”


i) Connect regulated power supply to 8086 kit
ii) Connect the 8279 with the 8086 kit using two parallel ATA cables & Switch on the
regulated power supply.
iii) Switch on the computer and open “win86e” trainer software
iv) Before clicking on 8279 modes click on device manager and check out USB serial port
whether organized or not.
v) Click on file and open the 8279 folder and select encoding Method Hex file.
vi) Observe download program and check starting and ending address.
vii) Click on command window and press z space starting address, ending address
viii) Observe the compiled program an command window, and enter g starting address for
execution
ix) Observe the o/p displayed on 7-segment display of 8279 kit.

ELECTRONICS AND COMMUNICATION ENGINEERING Page 37


UCE, AKNU MICROPROCESSOR AND MICROCONTROLLER LAB

1. PROGRAM TO DISPLAY ‘ESA PVT LTD’ USING DECODING METHOD:


ADDRESS OP-CODE LABELS MNEMONICS COMMENTS
0000:2000 B9 08 00 MOV CX,08
0000:2003 BO 00 MOV AL,00
0000:2005 BA C2 FF MOV DX,OFFC2 ;ROUTINE TO
CLEAR
0000:2008 EE OUT DX,AL
0000:2009 BO 90 MOV AL,90
0000:200B EE OUT DX,AL
0000:200C BO 00 RPT: MOV AL,00
0000:200E BA CO FF MOV DX,0FFC0
0000:2011 EE OUT DX,AL
0000:2012 E2 F8 LOOP RPT
0000:2014 BA C2 FF MOV DX,OFFC2 8 –BIT
CHARACTER
0000:2017 BO 01 MOV AL,01 DISPLAY LEFT
ENTRY
0000:2019 EE OUT DX,AL DECODED
SCAN
KEYBOARD
0000:201A BA C2 FF MOV DX,0FFC2
0000:201D BO 90 MOV AL,90 WRITE TO 8279
DISPLAY RAM
0000:201F EE OUT DX,AL
0000:2020 BE OO 21 BCK: MOV SI,2100 ROUTINE TO
DISPLAY ‘ESA’
0000:2023 B9 O4 00 MOV CX,O4
0000:2026 BA 04 BC0: MOV AL,[SI]
0000:2028 BA CO FF MOV DX,0FFC0
0000:202B EE OUT DX,AL
0000:202C 46 INC SI
0000:202d E2 f7 LOOP BC0
0000:202F E8 27 00 CALL DLY PROVIDE
SOME DELAY
0000:2032 BE 04 00 MOV SI,2104
0000:2035 B9 04 00 MOV CX,04
0000:2038 8A 04 BC1: MOV AL,[SI] ROUTINE TO
DISPLAY ‘PVT’
0000:203A BA CO FF MOV DX,0FFC0
0000:203D EE OUT DX,AL
0000:203E 46 INC SI
0000:203F E2 F7
0000:2041 E8 15 00 CALL DELAY PROVIDE
SOME DELAY
LOOP BC1
0000:2044 BE 08 21 MOV SI,2108
0000:2047 B9 04 00 MOV CX,04
0000:204A 8A CO FF BC2: MOV AL,[SI] ROUTINE TO
DISPLAY ‘LTD’
0000:204C BA CO FF MOV DX,0FFC0
0000:204F EE OUT DX,0FFC0
0000:2050 46 INC SI
ELECTRONICS AND COMMUNICATION ENGINEERING Page 38
UCE, AKNU MICROPROCESSOR AND MICROCONTROLLER LAB

0000:2051 CALL DELAY PROVIDE


SOME DELAY
0000:2053 LOOP BC2
JMP BCK
0000:2100 D6 77 DB 04 , 97
0000:2102 00 37 DB 0D6 ,77
0000:2104 E3 87 DB 00 ,37
0000:2106 00 83 DB 0F3 ,87
0000:2108 DB 00,83
DB 87,0ES

2. PROGRAM TO DISPLAY ‘ELECTRO SYSTEM INDIA-’ USING ENCODED


METHOD:
ADDRES Op-code LABELS MNEMONICS COMMENTS
0000:2000 B9 08 00 MOV CX, 08
0000:2003 BO 00 MOV AL,00
0000:2005 BA C2 FF MOV DX,OFFC2 ROUTINE TO
CLEAR
0000:2008 EE OUT DX,AL ALL DISPLAYS
0000:2009 BA C2 FF MOV AL,90
0000:200B EE OUT DX,AL
0000:200C BO OO RPT: MOV AL, 00
0000:200E BA CO FF MOV DX,0FFC0
0000:2011 EE OUT DX,AL
0000:2012 E2 F8 LOOP RPT
0000:2014 BA C2 FF MOV DX,0FFC2 8-BIT
CHARACTER
0000:2017 B0 10 MOV AL,10 DISPLAY
RIGHT
0000:2019 EE OUT DX,AL ENTERY
ENCODED
0000:201A BA C2 FF MOV DX,OFFC2 SCAN
KEYBOARD
0000:201d Bo 90 MOV AL,90 Write to 8279
0000:201f Ee OUT DX,AL Display ram
0000:2020 Be 00 21 BCK: MOV SI,2100 Routine to
display ‘electro’
0000:2026 8A 04 BC0: MOV AL,[SI]
0000:2028 BA CO FF MOV DX,0FFC0
0000:202B EE OUT DX,AL
0000:202C 46 INC SI
0000:202D E8 23 00 CALL DLY PROVIDE
SAME DELAY
0000:2030 E2 F4 LOOP BC0 B/W
CHARACTER
0000:2032 B9 08 00 MOV CX,08 ROUTINE TO
DISPLAY
‘SYSTEMS’
0000:2035 8A 04 BC1: MOV AL,[SI]
0000:2037 BA CO FF MOV DX,0FFC0
0000:203A EE OUT DX,AL
0000:203B 46 INC SI
ELECTRONICS AND COMMUNICATION ENGINEERING Page 39
UCE, AKNU MICROPROCESSOR AND MICROCONTROLLER LAB

0000:203C E8 14 00 CALL DLY PROVIDE


SOME DELAY
0000:203F E2 F4 LOOP BC1 B/W
CHARACTERS
0000:2041 B9 08 00 MOV CX,08 ROUTINE TO
DISPLAY
‘INDIA-‘
0000:2044 8A 04 BC2: MOV AL,[SI]
0000:2046 BA CO FF MOV DX,0FFC0
0000:2049 EE OUT DX, AL
0000:204A 46 INC SI
0000:204B E8 05 00 CALL DLY PROVIDE
SOME DELAY
0000:204E E2 F4 LOOP BC2 B/W
CHARACTERS
0000:2050 EA CD EF JMP BCK REPEAT
INFINITELY
THE STRING
0000:2053 51 DLY: PUSH CX
0000:2054 B9 00 00 MOV CX,FFFF DELAY
ROUTINE
0000:2057 E2 FE LOOP 2057
0000:2059 59 POP CX
0000:2060 C3 RET
ORG 2100 DISPLAY
LOOK-UP
TABLE
0000:2100 97 83 97 93 DB 97 ,83,97,93
0000:2104 87 30 F3 00 DB 87,30,0F3,00
0000:2108 D6 E6 D6 87 DB 0D6,OE6,0D6,87
0000:210C 93 73 D6 00 DB 93,73,0D6,00
0000:2110 60 73 E5 60 DB 60,73,0E5,60
0000:2114 77 00 04 00 DB 77,00,04,00

3. PROGRAM TO SCAN THE HEX KEY PAD AND TO DISPLAY THE CODE ON THE
SEVEN SEGMENT DISPLAY USING ENCODE METHOD.

ADDRES Op-code LABELS MNEMONICS COMMENTS


0000:2100 Bb 00 00 MOV DX,00
0000:2003 Ba c2 ff MOV DX,0FFC2
0000:2006 Bo 00 MOV AL, 00
0000:2008 Ee OUT DX, AL Routine to clear
0000:2009 Bo 00 MOV AL,00
0000:200b Ee OUT DX,AL
0000:200c B9 08 00 MOV CX,08
0000:200f Bo 00 MOV AL,00
0000:2011 Ba co ff MOV
DX,OFFCO
0000:2014 Ee Rpt: OUT DX,AL
0000:2015 E2 fd LOOP RPT
0000:2017 Be 50 20 Bck: MOV SI,2050
0000:201a Ba c2 ff MOV Read 8279 status
ELECTRONICS AND COMMUNICATION ENGINEERING Page 40
UCE, AKNU MICROPROCESSOR AND MICROCONTROLLER LAB

DX,OFFC2
0000:201d Ec Key: IN AL,DX To check if any
character is
available
0000:201e 24 07 AND AL,07
0000:2020 74 fb JZ KEY
0000:2022 Bo40 MOV A1,40
0000:2024 Ee OUT DX,AL
0000:2025 Bacoff MOV Read fifo ram
DX,OFFCO
0000:2028 Ec IN AL, DX Mask sift and ctrl
keys
0000:2029 24 if AND AL, IF

0000:202b 8a d8 MOV BL, AL Point to key


value
0000:202d 03 f3 ADD SI,BX
0000:202f Ba c2 ff MOV DX, Address to
OFFC2 display 0
0000:2032 B0 94 MOV AL, 94
0000:2034 Ee OUT DX, AL
0000:2035 Ba co ff MOV
DX,OFFCO
0000:2038 Bo f3 MOV AL, F3
0000:203a Ee OUT DX,AL
0000:203b Ba c2 ff MOV DX,0FFC2 Address t0
0000:203e B0 95 MOV AL,95 Display scanned
0000:2040 Ee OUTDX,AL
0000:2041 Ba co ff MOV DX,
OFFCO
0000:2044 8a o4 MOV AL, [SI]
0000:2046 EE OUT DX,AL
0000:2047 E9 cd ff JNP BCK
0000:2050 F3 60 b5f4 ORG 2050 Scan key values
0000:2054 66 d6 d7 70 DB Look up table
0F3,60,0B5,0F4
0000:2058 F7 76 77 c7 DB0F7,
76,77,0C7
0000:205c 93 e5 97 17 DB 93,0E5,77,17

RESULT: Hence we studied the operation of interfacing of 8279 peripherals with 8086
microprocessor using win 86e ESA.

ELECTRONICS AND COMMUNICATION ENGINEERING Page 41


UCE, AKNU MICROPROCESSOR AND MICROCONTROLLER LAB

MICROCONTROLLER TRAINERKIT
8051 family of microcontrollers and its derivatives are increasingly becoming popular for
instrumentation and control applications due to its speed and powerful instruction set which
are essential for real-time applications. This has created the need for a good trainer and
development tools. ESA 51E (a low cost version of ESA 51) provides complete solution for
this requirement. It can be used as a flexible instructional aid in academic institutions and a
powerful development kit in R&D Labs.

MAINFEATURES

 ESA 51E operates on single +5V power supply either in stand-alone mode using
PC keyboard and LCD or with host PC through serial (USB/RS-232-C) interface
in serial mode implemented using the on chip serial port of microcontroller.

 Stand-alone and serial monitor programs support the entry of user programs,
editing and debugging facilities like single stepping and full speed execution of
userprograms.

 Line assembler & disassembler both in stand - alone and serialmodes.


 Total on-board memory is 128K bytes of which 88K bytes RAM has battery
backupprovision.
CONFIGURATION OF ESA51E

ESA 51E Microcontroller Trainer is versatile and can be configured in two different
modes, which are determined by DIP switch settings (refer to the component layout
diagram in Appendix A to locate the DIP switch). This chapter describes all the
configurable options and the installationprocedures.

OPERATIONAL MODESELECTION
ESA 51E can be operated either in the stand-alone mode using PC keyboard and LCD or
in the serial mode through serial (USB/RS-232-C) interface. In the serial mode, the trainer
is connected to a host PC through a serial (USB/RS-232-C) interface. In either mode of
operation, the system provides a variety of commands for program
development/debugging, several features like one-line assembler, disassembler etc.; the
selection of the desired mode of operations is done as follows

[Link] Mode of Operation DIP-Switch 5 Status


1. Serial mode with RS-232-C interface ON*
2. Stand-alone mode OFF

ELECTRONICS AND COMMUNICATION ENGINEERING Page 42


UCE, AKNU MICROPROCESSOR AND MICROCONTROLLER LAB

BAUD RATESELECTION
In the serial mode of operation, ESA51 configures the on-chip port of 8051 as follows:
* Asynchronousmode
* 8-bit characterlength
* 1 stopbit
* noparity
Baud rate selection for Serial Communication (USB/RS-232-C) can be set using DIP
switches 6 to 8 as shown below:
S6 S7 S8 BaudRate
ON ON ON 1200
ON ON OFF 1200
ON OFF ON 1200
ON OFF OFF 1200
OFF ON ON 2400
OFF ON OFF 4800
OFF OFF ON 9600*
OFF OFF OFF 19,200

(* Factory installed option)

INSTALLATION OF ESA51E
To install ESA51E, the following accessories are required.
a) Power Supply 5V@ 1A ormore
b) For serial mode ofoperations
Host PC with the windows driver software for host PC. (Refer chapter 10 for details).

INSTALLATION PROCEDURES FOR SERIAL MODE OFOPERATION


a) Select serial mode of operations (Ref. Section2.1.1)
b) Select USB / RS-232-C communication (Ref. Section2.1.2)
c) Select printer if required (Ref. Section2.1.3)
d) Set the desired baud rate (Ref. Section2.1.4)
e) Connect ESA 51E to the host PC through serial (USB/RS-232-C) cable (Appendix
C describes the serial (USB/RS-232-C) interface requirements) over the connector
J2. (Refer Appendix A for locating the connectors). If a terminal is used, turn on
the terminal. If a computer system is being used, turn-on the system and execute
the driver software (Ref. Chapter 10 fordetails)
f) Connect the appropriate powersupply

ELECTRONICS AND COMMUNICATION ENGINEERING Page 43


UCE, AKNU MICROPROCESSOR AND MICROCONTROLLER LAB

ESA 51E performs POST (Power On Self Test) operation. During the POST operation all
register will be intialized to CPU‟s reset condition. Then displays the following Sign On
message followed by the command prompt „>‟ in the next line.

ESA 51E Serial monitor V x.y

INSTALLATION PROCEDURE FOR STAND-ALONE MODE OFOPERATION

a) Select stand-alone mode operation (Ref. 2.1.1)

b) Connect the power supply of required capacity to ESA51E and switch-on thepower.

Now the following message appears on the LCD for fewseconds

POST
Power- On Self Test is being done. Following initializations

are also done. All register will be initialized to CPU‟s reset

condition.

Then displays the following Sign On message followed by the command prompt `>' in the next
line.

ESA -51E

ESA 51E is ready for operation in the stand-alone mode

ELECTRONICS AND COMMUNICATION ENGINEERING Page 44


UCE, AKNU MICROPROCESSOR AND MICROCONTROLLER LAB

EXECUTION PROCEDURE FOR 8051

Writing a alp program into 8051:


Switch on kit

Press reset

Press A (give starting address)

Press enter

st
Enter 1 mnemonic

Press enter

Enter 2nd mnemonic

Press enter

---

Enter nth mnemonic

Press enter

RESET

To compile: Press G (give starting address)

Press enter
Press enter

Display: program executed

Result: Press R

A, B, R0, -------, Rn
For values to particular address location
Press MD(Address location)

PART- C: 8051 Assembly Language Programs


ELECTRONICS AND COMMUNICATION ENGINEERING Page 45
UCE, AKNU MICROPROCESSOR AND MICROCONTROLLER LAB

[Link].1: Programming using arithmetic instructions of 8051

Arithmetical operations:

i) 8 bit addition

AIM: To perform 8 bit addition by using 8051.

APPARATUS:8051Microcontroller kit with keyboard

ALGORITHM :
1. Load accumulator A with any desired 8-bit data.
2. Load the register B with the second 8- bit data.
3. Add these two 8-bit numbers.
4. Store the result.
5. Stop the program.

PROGRAM:

MEMORY LOCATION MNEMONIC

8000 MOV A,#04


MOV B,#02
ADD A,B
LCALL 03

OUTPUT:

Input Output

REGISTER Data REGISTER Data

A 02 A 04

B 02

ELECTRONICS AND COMMUNICATION ENGINEERING Page 46


UCE, AKNU MICROPROCESSOR AND MICROCONTROLLER LAB

ii) 8 bit subtraction

AIM:To perform 8 bit subtraction by using 8051.


APPARATUS: 8051 Microcontroller with keyboard

ALGORITHM :
1. Load accumulator A with any desired 8-bit data.
2. Load the register B with the second 8- bit data.
3. Subtract these two 8-bit numbers.
4. Store the result.
5. Stop the program.

PROGRAM:

MEMORY LOCATION MNEMONIC

8000 MOV A,#04


MOV B,#02
SUBB A,B
LCALL 03

OUTPUT:

Input Output

REGISTER Data REGISTER Data

A 04 A 02

B 02

ELECTRONICS AND COMMUNICATION ENGINEERING Page 47


UCE, AKNU MICROPROCESSOR AND MICROCONTROLLER LAB

iii) 8 bit multiplication:

AIM:To perform 8 bit multiplication by using 8051.

APPARATUS: 8051 Microcontroller kit with keyboard

ALGORITHM :
1. Get the multiplier in the accumulator.
2. Get the multiplicand in the B register.
3. Multiply A with B.
4. Store the product in memory.

PROGRAM:

MEMORY LOCATION MNEMONIC

8000 MOV DPTR, #9000


MOVX A,@DPTR
MOV F0,A

INC DPTR

MOVX A,@DPTR

MUL AB

LCALL 03

OUTPUT:

Input output

MEMORY LOCATION Data REGISTER Data

9000 03 A 06

9001 02

ELECTRONICS AND COMMUNICATION ENGINEERING Page 48


UCE, AKNU MICROPROCESSOR AND MICROCONTROLLER LAB

iv) 8 bit division:

AIM: To perform 8 bit division by using 8051.

APPARATUS: 8051 Microcontroller kit with keyboard

ALGORITHM :
1. Get the Dividend in the accumulator.
2. Get the Divisor in the B register.
3. Divide A by B.
4. Store the Quotient in memory

PROGRAM:

MEMORY LOCATION MNEMONIC

8000 MOV DPTR, #9000


MOVX A,@DPTR
MOV R0,A

INC DPTR

MOVX A,@DPTR

MOV F0,A

MOV A,R0

DIV AB

LCALL 03

OUTPUT:

Input output

MEMORY LOCATION Data REGISTER Data

9000 03 A 06

9001 02

ELECTRONICS AND COMMUNICATION ENGINEERING Page 49


UCE, AKNU MICROPROCESSOR AND MICROCONTROLLER LAB

v) 16 bit addition:

AIM: To perform 16 bit addition by using 8051.

APPARATUS: 8051 Microcontroller kit with keyboard

ALGORITHM :
1. Start the Program.
2. Get the first number is specific address.
3. Add the second number to the first number.
4. Add the two values
5. Store the sum
6. Stop the Program.

PROGRAM:

MEMORY LOCATION MNEMONIC

8000 MOV DPTR, #9500


8003 MOVX A,@DPTR
8004 MOV R0,A
8005 MOV R2,#00

8007 INC DPTR

8008 MOVX A,@DPTR

8009 MOV R1,A

800A INC DPTR

800B MOVX A,@DPTR

800C ADD A,R0

800D MOV R6,A

800E INC DPTR

800F MOVX A,@DPTR

8010 ADDC A,R1

8011 JNC 8014

8013 INC R2

8014 INC DPTR

ELECTRONICS AND COMMUNICATION ENGINEERING Page 50


UCE, AKNU MICROPROCESSOR AND MICROCONTROLLER LAB

8015 MOVX @DPTR,A

8016 INC DPTR

8017 MOV A.R6

8018 MOVX @DPTR,A

8019 INC DPTR

801A MOV A,R2

801B MOVX @DPTR,A

801C SJMP 801C

801E LCALL 03

OUTPUT:

Input Output

MEMORY Data MEMORY Data


LOCATION LOCATION

9500 BC 9504 80

9501 19 9505 34

9502 88 9506 01

9503 99

ELECTRONICS AND COMMUNICATION ENGINEERING Page 51


UCE, AKNU MICROPROCESSOR AND MICROCONTROLLER LAB

[Link].2: Programming using logical instructions of 8051

logical operations:

i) AND operation

AIM: To perform AND operation by using 8051.


APPARATUS: 8051Microcontroller kit with keyboard

ALGORITHM :
1. Load accumulator A with any desired 8-bit data.
2. Load the register R0 with the second 8- bit data.
3. AND these two 8-bit numbers.
4. Store the result.
5. Stop the program

PROGRAM:

MEMORY LOCATION MNEMONIC

MOV R0,#14
8000
MOV A,#12
ANL A,R0
MOV R1,A
LCALL 03

OUTPUT:

Input output

MEMORY LOCATION Data REGISTER Data

R0 14H R1 10

A 12H

ELECTRONICS AND COMMUNICATION ENGINEERING Page 52


UCE, AKNU MICROPROCESSOR AND MICROCONTROLLER LAB

ii) XOR operation

AIM: To perform XOR operation by using 8051.


APPARATUS: 8051 Microcontroller kit with keyboard

ALGORITHM :
1. Load accumulator A with any desired 8-bit data.
2. Load the register R0 with the second 8- bit data.
3. XOR these two 8-bit numbers.
4. Store the result.
5. Stop the program

PROGRAM:

MEMORY LOCATION MNEMONIC

MOV R0,#23
8000
MOV A,#34
XRL A,R0
MOV R1,A
LCALL 03

OUTPUT:

Input output

MEMORY LOCATION Data REGISTER Data

R0 23H R1 17

A 34H

ELECTRONICS AND COMMUNICATION ENGINEERING Page 53


UCE, AKNU MICROPROCESSOR AND MICROCONTROLLER LAB

ii) OR operation

AIM: To perform OR operation by using 8051.


APPARATUS: 8051 Microcontroller kit with keyboard.

ALGORITHM :
1. Load accumulator A with any desired 8-bit data.
2. Load the register R0 with the second 8- bit data.
3. OR these two 8-bit numbers.
4. Store the result.
5. Stop the program.

PROGRAM:

MEMORY LOCATION MNEMONIC

MOV R0,#8
8000
MOV A,#6
ORL A,R0
MOV R1,A
LCALL 03

OUTPUT:

Input output

MEMORY LOCATION Data REGISTER Data

R0 8H R1 14H

A 6H

ELECTRONICS AND COMMUNICATION ENGINEERING Page 54


UCE, AKNU MICROPROCESSOR AND MICROCONTROLLER LAB

EXP NO:3 Finding no. of 1’s and 0’s in a given 8 bit number

AIM: Program in 8051 microcontroller to find out the number of 1’s and 0’s in a
8bit number.

APPARATUS: 1. 8051 kit ----1


2. RPS (+5V) ----1
ALGORITHM :
1. Initialize registers R1,R2,R7.
2. Load accumulator A with any desired 8-bit data.
3. Rotate the 8-bit data
4. Store the result.
5. Stop the program.

PROGRAM:

MEMORY LOCATION MNEMONIC

8000
MOV R1,#00
8002
MOV R2,#00
8004
MOV R7,#08
8006
MOV A,#97
8008
RLC A
8009
JC 800E
800B
INC R2
800C
DJNZ R7,8008
800E
SJMP 8010

OUTPUT:

Inpu
t Output

REGISTER Data REGISTER Data

Number of
R0 24H zero’s R1 06

Number of
one’s R2 02

ELECTRONICS AND COMMUNICATION ENGINEERING Page 55


UCE, AKNU MICROPROCESSOR AND MICROCONTROLLER LAB

EXP NO:4 Program for sorting an array in ascending order using 8051kit
AIM: Program to sort the given numbers in ascending order

APPARATUS: 1. 8051 kit ----1


2. RPS (+5V) ----1
ALGORITHM :

1. Load the array count in two registers.


2. Get the first two numbers.
3. Compare the numbers and exchange if necessary so that the two numbers are
in ascending order.
4. Increment DPTR.
5. Get the third number from the array and repeat the process.

PROGRAM:

MEMORY LOCATION MNEMONIC

8500 MOV R0,#05


8502 MOV A,R0
8503 MOV R1,A
8504 MOV DPTR,#8600
8507 PUSH 83
8509 PUSH 82
850B MOVX A,@DPTR
850C MOV R0,A
850E INC DPTR
850F MOVX A,@DPTR
8510 CJNZ A,R0,8513
8513 JNC 851E
8515 POP 82
8517 POP 83
8519 MOVX @DPTR,A
851A INC DPTR
851B MOV A,R0
851D MOVX @DPTR,A
851E DJNZ R1,8507
8520 DJNZ R0,8502
8522 SJMP 8522

ELECTRONICS AND COMMUNICATION ENGINEERING Page 56


UCE, AKNU MICROPROCESSOR AND MICROCONTROLLER LAB

OUTPUT:

INPUT OUTPUT

Memory Memory
Data Data
Location Location

8600 05H 2000 04H

8601 08H 2001 05H

8602 07H 2002 07H

8603 04H 2003 08H

VIVA:

1. What is difference between microprocessor and microcontroller?

2. Why 8051 is called 8 bit Microcontroller?

3. What is the width of Data Bus?

4. What is the width of Address Bus?

5. List out the features of 8051 Microcontroller?

6. What is Special Function Registers (sfr)?

7. What are the types of Interrupts in 8051?

8. What are the four distinct types of Memories in 8051?

9. Explain Db.?

10. Are all the bits of Flag Register used in 8051?

ELECTRONICS AND COMMUNICATION ENGINEERING Page 57


UCE, AKNU MICROPROCESSOR AND MICROCONTROLLER LAB

ELECTRONICS AND COMMUNICATION ENGINEERING Page 58

You might also like