Microcontrollers Lab
Microcontrollers Lab
VISION
GITAM aims to be an outstanding Institute in India through academic excellence in the field of
Technology and Management to fulfill the need of the Industry and serve the society.
MISSION
To provide healthy environment to our students as well as faculty members.
To achieve excellence in technical education.
To promote holistic development of students through interaction with alumni, academia,
Industry and expert lectures.
To attract nurture and retain the best faculty and technical manpower.
To contribute to the society by inculcating professional ethics in the students.
To promote research and development Initiatives.
MISSION
To have adequate mechanisms by improving the understanding and implementation of
theoretical concepts in practical scenario.
To develop technical manpower by organizing workshops, expert lectures and industrial
visits on regular basis.
To impart quality teaching-learning experience with state of the art laboratories.
To prepare the students to meet the global needs of Industry and Society by inculcating
professional ethics.
PO-5 Modern Tool Usage: Create, select, and apply appropriate techniques, resources, and
modern engineering and IT tools including prediction and modeling to complex engineering
activities with an understanding of the limitation.
PO-6 The Engineer and Society: Apply reasoning informed by the contextual knowledge
to assess societal, health, safety, legal and cultural issues and the consequent responsibilities
relevant to the professional engineering practice.
PO-8 Ethics: Apply ethical principles and commit to professional ethics and responsibilities
and norms of the engineering practice.
PO-12 Life-long Learning: Recognize the need for, and have the preparation and ability to
engage in independent and life-long learning in the broadest context of technological
change.
PROGRAM SPECIFIC OUTCOMES
PSO1: Analyze, design and implement hardware and software skills to solve problems in
electronics and communication engineering in various areas such as analog & digital
electronics, signal processing, communication, VLSI, embedded systems and its allied
branches by applying basic sciences and engineering fundamentals.
PSO2: Adapt rapid changes in the field of electronics and communication engineering and
also employs their skills for the multidisciplinary work environment, to be a successful
professional/entrepreneur and worthy citizen
Sr.
Description COs Page No.
No.
1 To study the architecture of 8086 microprocessor and 8086 CO1 7
microprocessor kit.
5 Write a program for division of two 16 bit numbers using 8086 CO3 18
instruction set.
10 Write a program to find the sum of the first ‘n’ integers. CO2 32
COURSE OUTCOMES
RBT
COs Microcontrollers Lab (LC-ECE-214 G)
Level
Define fundamental architectural and programming concepts of 8086. L1
LC-ECE-214 G.1
Understand the instruction set and process used for 8086 L2
LC-ECE-214 G.2 programming.
Analyze and compare the logic used in programs output carried out by L4
LC-ECE-214 G.4 8086 microprocessor theoretically and practically.
CO/PO PO1 PO2 PO3 PO4 PO5 PO6 PO7 PO8 PO9 PO10 PO11 PO12 PSO1 PSO2
CO1 1 3
CO2 1 3 3 3 2 2 2 1
CO3 3 1 3 3 3 3 2 2 2 2 3
CO4 3 3 3 3
EXPERIMENT NO.1
AIM: - To study the architecture of 8086 microprocessor and 8086 microprocessor kit.
16K Bytes of EPROM Loaded with monitor expandable to 64K Bytes using 27C512.
16K bytes of CMOS RAM expandable to 64K Bytes using 6264/62256.
Battery Backup using 3.6V Ni-Cd Battery.
72 Parallel I/O lines using three numbers of 8255 PPI .Serial Comm. RS-232-C Interface using
8251 PCI.
8 different level Interrupt using 8259 PIC. Three16 bit Timer/Counter using 8253 PIT.
System Installation: To install M86-02 the following additional things are required.
1. Connect the AC Power Supply through AC Power Chord provided to the M86-02 Kit.
2. Switch on the Power Supply at the rear end.
3. A message - [M86-02 L] will come on display (PRESS RESET if you do not get-[M86-02 L]).
4. Now M86-02 Kit is ready for the user's experiments for Keyboard Mode commands.
Hardware Description and CPU: 8086 is a 16 bit, third generation microprocessor and is suitable
for an exceptionally wide spectrum of microcomputer applications. This flexibility is one of most
outstanding characteristics. 8086 has got 16 data lines and 20 address lines. The lower 16 address
lines are multiplexed with 16 data lines. Hence it becomes necessary to latch the address lines. This
is done by using 74LS373.
In fact several of the 40 CPU pins have dual functions that are selected by a strapping pin. In this
kit 8086 is used in the Maximum Mode (MN/MX input held logically low).
The 8088 is designed with an 8-bit external path to memory and I/O.
Except that the 8086 can transfer 16 bits at a time, the two processors &Software are identical in
almost every respect. Software written for one CPU will execute on the other without alteration.
The two processors are designed to operate with the 8089 I/O processors and other processors in
multiprocessing and distributed processing systems.
The INTR, TEST & Hold Inputs to 8086 are pulled down and are brought out at PCB FRC
connector.
The maskable interrupt INTR is available to the peripheral circuits through the expansion Bus. To
use the maskable interrupt an interrupt vector pointer must be provided on the data bus when INTA
is active.
An interrupt Controller Circuit is provided to take care of more than one source of interrupt.
Co-Processor 8087: The 8087 Co-processor “hooks” have been designed into the 8086 and 8088
so that these types of processor can be accommodated in the future. A co-processor differs from an
independent processor in that it obtains its instructions from another processor, called a host. The
co-processor monitors instructions fetched by the host and recognizes certain of these as its own
and executes them. A co-processor, in effect, extends the instruction set of its host computer.
I/O Processor 8089: The 8086 and 8088 are designed to be used with the 8089 in high
performance I/O applications. The 8089 in conceptually resembles a microprocessor with two
DMA channels and an instruction set specifically tailored for I/O operations. Unlike simple DMA
controllers, the 8089 can service I/O devices directly, removing this task from the CPU. In addition,
it can transfer data on its own bus or on the system bus, can match 8-bit or 16-bit peripherals to 8-
bit or 16-bit buses, and can transfer data from memory to memory and from I/O devices to I/O
device. 8089 has been used here in local mode. The system bus, can match 8-bit or 16-bit
peripherals to 8-bit or 16-bit buses, and can transfer data from memory to memory and from I/O
devices to I/O device. 8089 has been used here in local mode.
Clock Generation8284: The clock generator circuit is an Intel’s 8284 clock generator/driver. The
circuit accepts a crystal input which operates at a fundamental frequency of 14.7456 MHz (14.7456
MHz was selected since this frequency is a multiple of the baud rate clock and also provides a
suitable frequency for the CPU). The clock generator/driver divides the crystal frequency by three
to produce the 4.9 MHz CLK signal required by the CPU. Additionally, the clock generator
performs a further divide-by-two output called PCLK (peripheral clock) which is the primary clock
signal used by the remainder of the circuits. The clock generator/driver provides two control signal
outputs which are synchronized (internally) to the 4.9 MHz CLK signal; RDY (ready) and RST
(reset). RST is used to reset the M86-02 to an initialized state that occurs when the RES input goes
low (when power first is applied or when the SYSTEM RESET key is pressed). The RDY output is
active (logically high) when the RDY 1 input from the wait state generator is active. As will be
explained in the next section, the RDY 1 input is active whenever onboard memory is addressed or
when a selected number of “wait states” occurs. The system can operate at either 4.9 MHz or 2.45
MHz this is selected by a set of jumpers JP3 on the right hand side of the 8284 clock generator as
shown below:
4.9 MHz (UPPER), CLK, 2.45 MHz (LOWER). The M86-02 is supplied in 4.9 MHz configuration.
Bus Controller8288: The 8288 is a Bus Controller which decodes status signals output by an 8089,
or a maximum mode 8086 or 8088. When these signals indicate that the processor is to run a bus
cycle, the 8288 issues a bus command that identifies the bus cycle as memory read, memory write,
I/O read, I/O write, etc. It also provides a signal that strobes the address into latches. The 8288
provides the drive level needed for the bus control lines in medium to large systems.
Memory: M86-02 provides 16K Bytes of EPROM loaded with monitor and 16K bytes of CMOS
RAM. The total onboard memory can be configured as follows: EPROM&RAM
64K Bytes of EPROM using 27128, 128K Bytes of EPROM using 27256, 256K Bytes of EPROM
using 27512. 128K Bytes of RAM using 62256. The system provides two 28 Pin sockets for the
EPROM area named as EVEN-ROM & ODD-ROM and two 28 Pin sockets for the RAM area
named as EVEN-RAM & ODD-RAM. EVEN-ROM & ODD-ROM can be defined to have either
of the EPROM 27128/27256/27512 and the EVEN-RAM & ODD-RAM can be defined to have
either of 6264/62256. This selection is done by changing the jumper connections on the board of
the kit. With the 20 bit address of 8086, a total of 1 Mega Bytes (1MB) of memory can be
addressed with the address slot as 00000 to FFFFF. Although the total onboard memory capacity is
384K Bytes but actual memory area will depend upon the memory chips selected and accordingly
the addresses of the various memory sockets will change.
and Port-C lower. Any Input/output combination of Port-A, Port-B, Port-C upper and Port-C lower
can be defined using the appropriate software commands. The Port addresses for these ports are
given here. M86-02 provides nine Input/output ports of 8 lines each using three 8255 chips. These
ports are brought out at connectors.
Programmable Interrupt Controller (PIC) 8259: The 8259 is a device specifically designed for
use in real time, interrupt driven microcomputer systems. It manages eight levels of requests and
has built in features for expandability to other 8259’s. It is programmed by system’s software as an
I/O peripheral. A selection of priority modes in which the requests are processed by 8259 can be
configured to match his system requirements. The priority modes can be changed or reconfigured
dynamically at any time during the main program.
Battery Backup: The M86-02 provides a battery backup for the onboard RAM area using 3.6V Ni-
Cd Rechargeable battery. M86-02 has facility for connecting +5V to the RAM area if the Ni-Cd
battery fails. The selection for +5V or Battery supply Jumper (JP1).
Display: This display contains 2 lines and each line consists of 20 words (20x2). This is a cursor
LCD display modular. The CPU receives each 8 bits letter which is locked into the internal display
data of RAM (data display of RAM 80 bytes (D.D.RAM) allows 80 characters to be stored), and
transfer to 5x7 dot of array word and appear on the displayed. This LCD modular contains the word
generator ROM that will supply 160 different 5x7 dot of array word and also a 64 bytes word
generator RAM. Users can define 8 types 5x7 dot of array word. The position of word display goes
into the LCD Modular through the data bus in CPU. Next through the instruction register and
finally write the words into the data register to display on a specific location. The LCD Modular
will automatically increase or decrease the words in order to move to different addresses. The user
can therefore continue sending in word code. The cursor as to moved around or moved in the right
of left direction.
Draw Diagrams: 8086 Kit, Architecture & Pin Diagrams of 8086 microprocessor
Steps to Insert and execute any program in M86-02 (8086) Microprocessor Trainer Kit
1 Power on M86-02 8086 Microprocessor Trainer Kit.
RESULT: We have successfully studied the 8086 microprocessor and 8086 microprocessor kit.
PRECAUTIONS: 1. Properly connect the microprocessor kit with power supply terminals.
3. Make sure that all the machine codes should be as per specified in
program.
EXPERIMENT NO.2
AIM: Write a program to add the contents of the memory location to the content of other memory
location and store the result in 3rd memory location.
THEORY: Take any two numbers from the memory locations from the same data segment starting
from address 0000H. One number should be in the AX (accumulator)from 1 st ML and other number
from 2ndM.L. Now add the two numbers by using ADD command directly, the result would be
stored in the AX. Now result of SUM of two numbers in AX will be copied at 3 rdML/MA
0700H=07H, 0701H=00H
DATA: First Memory Location at (0500H) = 0005H (First Number)(at ML/MA 0500H=05H,
0501H=00H)
Second Memory Location at (0600H) = 0002H (Second Number) (at ML/MA 0600H=02H,
0601H=00H)
ALP to ADD the contents of the 1st M.L. to the content of 2nd M.L. and store the result in 3rd
M.L. Numbers on 8086 kit, and all three M.L.’s are in same Data Segment.
MEMOR MACHIN LABE MNEM OPERAND COMMENTS
Y E CODE L ONICS
ADDRES
S
0400 B8,00,00 MOV AX,0000H Initialize AX with value 0000H
0403 8E,D8 MOV DS,AX Initialize DS with value 0000H
0405 A1,05,00 MOV AX,[0500H Copy First Number (0005H) in AX
] register from First Memory Location at
(0500H)
0408 03,30,00,0 ADD AX,[0600H Add Second No.(0002H) from Second
6 ] ML at (0600H) & Store Result of SUM
in AX
040C A3,00,07 MOV [0700H Copy contents of AX at memory
],AX location 0700H in same Data Segment
040F 76 HLT Halt / Stop the program.
PROCEDURE:
1) Switch on the 8086 microprocessor kit.
2) Press ‘RESET’.
3) After reset, press ‘REL EXEM’.
4) Then press ‘MEMC NEXT’.(We can go from address to data)
5) Put the data.
RESULT: SUM of Two Numbers at Third Memory Location at (0700H) = 0007H (Sum)
(at ML/MA 0700H=07H,0701H=00H)
PRECAUTIONS: 1. Properly connect the microprocessor kit with power supply terminals.
3. Make sure that all the machine codes should be as per specified in the
program.
EXPERIMENT NO.3
AIM: Write a program to add 16 bit number using 8086 instruction set.
THEORY: Take any two numbers from the memory location or by the immediate addressing in to
the two registers. One number should be in the AX (Accumulator) and other number is any of the
registers like BX or other. Now add the two numbers by using ADD command directly, the result
would be stored in the AX.
PROCEDURE:
1) Switch on the 8086 microprocessor kit.
2) Press ‘RESET’.
3) After reset, press ‘REL EXEM’.
4) Then press ‘MEMC NEXT’.(We can go from address to data)
5) Put the data.
6) Press ‘FILL’ button.
7) Then ‘GO’.
8) Enter the starting address.
9) Press ‘FILL’.
10) After that ‘E’ is printed on keypad.
11) Then press ‘RESET’ and then ‘REL EXMEM’.
12) After that write last address where your data is stored.
13) Then press ‘MEMC NEXT’ then your result is showing.
PRECAUTIONS: 1. Properly connect the microprocessor kit with power supply terminals.
3. Make sure that all the machine codes should be as per specified in
program.
EXPERIMENT NO.4
AIM: Write a multiplication of two 16 bit numbers using 8086 instruction set.
THEORY: Take any two numbers from the memory location or by the immediate addressing in to
the two registers. One number should be in the AX (Accumulator) and other number is any of the
registers like CX or other. Multiply the two no’s by using MUL command directly, the result will
be stored in the AX & DX.
ALP for MULTIPLICATION two 16 bit Hexadecimal Numbers on microprocessor 8086 kit
MEMORY MACHINE LABEL MNEMO OPERAND COMMENTS
ADDRESS CODE NICS
0400 B8,73,92 MOV AX,9273 H Copy first Number in AX register
0403 B9,35,48 MOV CX,4835 H Copy second Number in CX register
0406 F7,E1 MUL CX Multiply the two 16 bits Numbers & store
result in AX and DX registers
0408 CC INT 3 Interrupt of program, break point instruction
used for debugging.
PROCEDURE:
1) Switch on the 8086 microprocessor kit.
2) Press ‘RESET’.
3) After reset, press ‘REL EXEM’.
4) Then press ‘MEMC NEXT’.(We can go from address to data)
5) Put the data.
6) Press ‘FILL’ button.
7) Then ‘GO’.
8) Enter the starting address.
9) Press ‘FILL’.
10) After that ‘E’ is printed on keypad.
11) Then press ‘RESET’ and then ‘REL EXMEM’.
12) After that write last address where your data is stored.
13) Then press ‘MEMC NEXT’ then your result is showing.
PRECAUTIONS: 1. Properly connect the microprocessor kit with power supply terminals.
3. Make sure that all the machine codes should be as per specified in the
Program.
EXPERIMENT NO: 5
AIM: Write a program for division of two 16 bit numbers using 8086 instruction set.
THEORY: Take any two numbers from the memory location or by the immediate addressing in to
the two registers. One number should be in the AX (Accumulator) and other number is any of the
registers like CX or other. Divide the two No’s by using DIV command directly, the result would
be stored in the AX & DX.
DATA: First Number Lower order 16 bit = A9DFH (in AX register) (Dividend)
ALP for DIVISION of 32 bit number by 16 bit number on microprocessor 8086 kit
MEMORY MACHINE LABEL MNEMO OPERAND COMMENTS
ADDRESS CODE NICS
0400 B8,DF,A9 MOV AX,A9DFH Copy Lower order 16 bit first Number in AX
0403 BA,4E,29 MOV DX,294E H Copy Higher order 16 bit first Number in DX
0406 B9,35,48 MOV CX,4835 H Copy second Number in CX register
0409 F7,F1 DIV CX Divide the two Numbers & store result in AX
040B CC INT 3 Interrupt of program, break point instruction
used for debugging.
PROCEDURE:
1) Switch on the 8086 microprocessor kit.
2) Press ‘RESET’.
3) After reset, press ‘REL EXEM’.
4) Then press ‘MEMC NEXT’.(We can go from address to data)
5) Put the data.
6) Press ‘FILL’ button.
7) Then ‘GO’.
8) Enter the starting address.
9) Press ‘FILL’.
10) After that ‘E’ is printed on keypad.
11) Then press ‘RESET’ and then ‘REL EXMEM’.
12) After that write last address where your data is stored.
13) Then press ‘MEMC NEXT’ then your result is showing.
RESULT: Lower order result of DIVISION of Two Numbers = 9273H (in AX register) (Quotient)
Higher order result of DIVISION of Two Numbers = 0010H (in DX register) (Remainder)
PRECAUTIONS: 1. Properly connect the microprocessor kit with power supply terminals.
3. Make sure that all the machine codes should be as per specified in
Program.
EXPERIMENT NO: 6
AIM: Write a program factorial of a number.
THEORY: The number for which we have to find out its factorial should be kept or copied in AL
register. Also this number should be kept or copied in CL register for count used for multiplication
purpose. After continuous comparisons and multiplications we get desired factorial in AX register.
Then get desired factorial in AX register will be copied at desired memory location. Here algorithm
will be, Input No. to AL, CL=AL, If No.=1 then Factorial=1 then exit, b=2, a=1, b=a*b, b=b+1, If
b<=CL then go to b=a*b, If b>CL then Factorial=AX
040D 74,07 JE/JZ GO If 01H< No. in AL, then use next Instruction
0419 76,03 JNA/JBE BACK If BL<= CL, then jump to label BACK
PROCEDURE:
1) Switch on the 8086 microprocessor kit.
2) Press ‘RESET’.
3) After reset, press ‘REL EXEM’.
4) Then press ‘MEMC NEXT’.(We can go from address to data)
5) Put the data.
6) Press ‘FILL’ button.
7) Then ‘GO’.
8) Enter the starting address.
9) Press ‘FILL’.
10) After that ‘E’ is printed on keypad.
11) Then press ‘RESET’ and then ‘REL EXMEM’.
12) After that write last address where your data is stored.
13) Then press ‘MEMC NEXT’ then your result is showing.
PRECAUTIONS: 1. Properly connect the microprocessor kit with power supply terminals.
3. Make sure that all the machine codes should be as per specified in program.
THEORY: To transfer a block of data, first take a single byte (8 bit of data) into accumulator from
its original memory location in SI and then it is transferred to desired memory location in DI. We
take 0000H in AX for initialization and then transfer it in DS and ES. So AX, DS and ES are
cleared or having value 0000H. Now CX is loaded with the total number of data bytes (count) to be
transferred. The data is transferred byte by byte by using MOVSB instruction to destination with
counter CX decrementing at each step. Using CLD instruction (clear the direction flag, DF=0) then
contents of SI and DI will auto incremented by one. When counter CX reaches to zero, the process
of transferring is stopped i.e. whole block of data is transferred.
DATA:
RESULT:
ALP to TRANSFER(or Shift) a Block (or String) of data without overlap in Forward on 8086 kit
MEMORY MACHINE LABEL MNEMONI OPERAND COMMENTS
ADDRESS CODE CS
0400 B8,00,00 MOV AX,0000H Copy 0000H into AX register for clear
0403 8E,D8 MOV DS,AX Copy 0000H into DS register for clear
0405 8E,C0 MOV ES,AX Copy 0000H into ES register for clear
0407 BE,00,05 MOV SI,0500H SI offset filled with 0500H (source address)
040A BF,00,06 MOV DI,0600H DI offset filled with 0600H (destination add)
PROCEDURE:
1) Switch on the 8086 microprocessor kit.
2) Press ‘RESET’.
3) After reset, press ‘REL EXEM’.
4) Then press ‘MEMC NEXT’.(We can go from address to data)
5) Put the data.
6) Press ‘FILL’ button.
7) Then ‘GO’.
8) Enter the starting address.
9) Press ‘FILL’.
10) After that ‘E’ is printed on keypad.
11) Then press ‘RESET’ and then ‘REL EXMEM’.
12) After that write last address where your data is stored.
13) Then press ‘MEMC NEXT’ then your result is showing.
PRECAUTIONS: 1. Properly connect the microprocessor kit with power supply terminals.
THEORY: To transfer a block of data, first take a single byte (8 bit of data) into accumulator from
its original memory location in SI and then it is transferred to desired memory location in DI. We
take 0000H in AX for initialization and then transfer it in DS and ES. So AX, DS and ES are
cleared or having value 0000H. Now CX is loaded with the total number of data bytes (count) to be
transferred. The data is transferred byte by byte by using MOVSB instruction to destination with
counter CX decrementing at each step. Using CLD instruction (clear the direction flag, DF=0) then
contents of SI and DI will auto incremented by one. When counter CX reaches to zero, the process
of transferring is stopped i.e. whole block of data is transferred.
DATA:
0500H (1st Byte) = 11H
0501H (2nd Byte) = 22H
0502H (3rd Byte) = 33H
0503H (4th Byte) = 44H
0504H (5th Byte) = 55H
RESULT:
ALP to TRANSFER(or Shift) a Block (or String) of data without overlap in Reverseon 8086 kit
MEMORY MACHINE LABEL MNEMON OPERAND COMMENTS
ADDRESS CODE ICS
0400 B8,00,00 MOV AX,0000H Copy 0000H into AX register for clear
0403 8E,D8 MOV DS,AX Copy 0000H into DS register for clear
0405 8E,C0 MOV ES,AX Copy 0000H into ES register for clear
0407 BE,00,05 MOV SI,0500H SI offset filled with 0500H (source address)
PROCEDURE:
1) Switch on the 8086 microprocessor kit.
2) Press ‘RESET’.
3) After reset, press ‘REL EXEM’.
4) Then press ‘MEMC NEXT’.(We can go from address to data)
5) Put the data.
6) Press ‘FILL’ button.
7) Then ‘GO’.
8) Enter the starting address.
9) Press ‘FILL’.
10) After that ‘E’ is printed on keypad.
11) Then press ‘RESET’ and then ‘REL EXMEM’.
12) After that write last address where your data is stored.
13) Then press ‘MEMC NEXT’ then your result is showing.
PRECAUTIONS: 1. Properly connect the microprocessor kit with power supply terminals.
3. Make sure that all the machine codes should be as per specified in program.
EXPERIMENT NO.8
AIM: Write a program to find the average of two numbers.
THEORY: Take any two numbers from the memory location or by the immediate addressing in to
the two registers. One number should be in the AX (Accumulator) and other number is any of the
registers like BX or other. Now add the two numbers by using ADD command directly, the result
would be stored in the AX.
Then Divide contents of AX by two by using SAR AX, 1 instruction and store result in AX register.
ALP for AVERAGE of two 16 bit Hexadecimal Numbers on microprocessor 8086 kit
MEMORY MACHINE LABEL MNEMONICS OPERAND COMMENTS
ADDRESS CODE
0400 B8,08,00 MOV AX,0008 H Copy first Number
in AX register
0403 BB,04,00 MOV BX,0004 H Copy second
Number in BX
register
0406 01,D8 ADD AX,BX Add the two
Numbers& store
result in AX
0408 D1,F8 SAR AX,1 Shift the contents of
AX right by one bit
040A CC INT 3 Interrupt of program,
break point
instruction used for
debugging.
PROCEDURE:
1) Switch on the 8086 microprocessor kit.
2) Press ‘RESET’.
3) After reset, press ‘REL EXEM’.
4) Then press ‘MEMC NEXT’.(We can go from address to data)
5) Put the data.
6) Press ‘FILL’ button.
7) Then ‘GO’.
8) Enter the starting address.
9) Press ‘FILL’.
10) After that ‘E’ is printed on keypad.
11) Then press ‘RESET’ and then ‘REL EXMEM’.
12) After that write last address where your data is stored.
13) Then press ‘MEMC NEXT’ then your result is showing.
PRECAUTIONS: 1. Properly connect the microprocessor kit with power supply terminals.
3. Make sure that all the machine codes should be as per specified in the program.
EXPERIMENT NO.9
AIM: Write a program to find maximum number in the array of 03 numbers.
THEORY: Let there are 3 numbers in given series and therefore the count is placed in memory
locations (ML) 0500H and 0501H and copied in CX as 0003H. The numbers are placed in memory
locations from 0502H to 0507H. Each memory location store only one byte (8 Bit) of data. First
number in series is placed in AX and compared with second number residing in memory locations.
The Largest of two numbers is placed in AX. Again number in AX is compared with third number
of series and Largest Number is stored in AX. The process of comparison is repeated till all the
numbers of series is compared and result of Largest Number is stored in AX is stored at ML 0550H
and 0551H.
DATA:
0500H (Lower Count) = 03H
0501H (Higher Count) = 00H
0502H (Lower 1st Byte) = 11H
0503H (Higher 1st Byte) = 22H
RESULT:
0504H (Lower 2nd Byte) = 33H
0505H (Higher 2nd Byte) = 44H
0506H (Lower 3rd Byte) = 55H
0507H (Higher 3rd Byte) = 66H
040A 3B,04 CMP AX,[SI] Compare 1st No. in AX with 2nd No. at
ML in SI
040C 73,02 JAE GO If AX > = ML, then jump to label GO
040E 8B,04 MOV AX,[SI] If AX< ML, then contents of SI copied in
AX
0410 E2,F6 GO LOOP BACK If CX not = 0, then jump to label BACK
0412 A3,50,05 MOV [0550],A Copy Largest No. in AX at ML 0550H &
X 0551H
0415 CC INT 3 Interrupt of program, break point
instruction used for debugging.
PROCEDURE:
1) Switch on the 8086 microprocessor kit.
2) Press ‘RESET’.
3) After reset, press ‘REL EXEM’.
4) Then press ‘MEMC NEXT’.(We can go from address to data)
5) Put the data.
6) Press ‘FILL’ button.
7) Then ‘GO’.
8) Enter the starting address.
9) Press ‘FILL’.
10) After that ‘E’ is printed on keypad.
11) Then press ‘RESET’ and then ‘REL EXMEM’.
12) After that write last address where your data is stored.
13) Then press ‘MEMC NEXT’ then your result is showing.
RESULT: We have successfully find out the maximum number in array of 3 numbers.
PRECAUTIONS: 1. Properly connect the microprocessor kit with power supply terminals.
3. Make sure that all the machine codes should be as per specified in the
program.
EXPERIMENT NO.10
AIM: Write a program to find the sum of the first ‘n’ integers.
THEORY: Take any three numbers from the memory locations. First number should be in the AX
(Accumulator) and Second number is at some memory location. Now add the two numbers by using
ADD command directly, the result would be stored in the AX. Now add the Third number to Sum
of two numbers in AX by using ADD command directly, the result would be stored in the AX.
Copy result of Sum in AX at Memory Location / Address (ML/MA) 0601H. Note that numbers
should be choose that their sum do not exceed the highest range of 16 bit i.e. FFFFH.
PROCEDURE:
ALP to find the SUM of 16 bit n numbers and SUM is 16 bit on microprocessor 8086 kit
MEMORY MACHINE LABEL MNEMO OPERAND COMMENTS
ADDRESS CODE NICS
0400 B8,00,00 MOV AX,0000H Initial SUM is 0000H in AX
0403 BE,01,05 MOV SI,[0501H] Starting Memory Address of Data in SI
0406 8B,0C MOV CX,[SI] Copy contents of SI i.e. Count in CX
RESULT: SUM of Three Numbers = FFCCH (in AX register and at ML/MA 0601H=CCH,
0602H=FFH)
PRECAUTIONS: 1. Properly connect the microprocessor kit with power supply terminals.
3. Make sure that all the machine codes should be as per specified in the
program.
EXPERIMENT NO.11
AIM: Write a program to generate a square wave.
THEORY: First we have to initialize 16 bit control word register (CWR) of 8253 having value
FFDEH. The value FFDEH must be copied in DX register. Then we have to select Counter-1 /
Timer-1. For selection of Counter-1 / Timer-1of 8253 IC, we have to copy FFDAH in DX register.
For generating square wave we must short pins numbers 9 and 15 of 8253 IC. The square wave
output will available at pin number 13 of 8253 IC.
ALP to generate SQUARE WAVE using 8253 at Timer-1 on microprocessor 8086 kit
MEMORY MACHINE LABEL MNEMONICS OPERAND COMMENTS
ADDRESS CODE
0400 BA,DE,FF MOV DX,FFDE Copy FFDEH into DX register for
H CWR
0403 B0,76 MOV AL,76H Copy 76H into AL register
PROCEDURE:
PRECAUTIONS: 1. Properly connect the microprocessor kit with power supply terminals.
3. Make sure that all the machine codes should be as per specified in the
program.
EXPERIMENT NO: 12
AIM: Write a program of Programmable Keypad and LCD Interface – 8279
THEORY: The objective of this lab is to show how the 8279 chip can be used to control the
Keypad and LCD. 2. The 8279 is a programmable keyboard and display interfacing chip. It scans
and encodes up to a 64-key keyboard where the keyboard matrix can be any size from 2x2 to 8x8. It
also controls up to a 16-digit numerical display. The keyboard section has a built-in FIFO 8
character buffer. The display is controlled from an internal 16B RAM that stores the coded display
information. The following figure shows the pin-out definition of 8279:
1. A0: selects data (0) or control/status (1) for reads and writes between 8086 and 8279.
2. !BD: output that blanks the displays.
3. CLK: used internally for timing. Max is 3 MHz
4. CN/ST: connected to the control key on the keyboard.
5. DB7 -DB0 : bidirectional pins that connect to data bus on 8086.
6. IRQ: becomes 1 when a key is pressed, data is available.
7. OUT A3 -A0 /B3 -B0 : outputs that sends data to the most o significant/least significant
nibble of the display.
8. RL7 -RL0 : return lines are inputs used to sense key depression in the keyboard matrix.
9. Shift: connects to Shift key on keyboard.
10. SL3 -SL0 : scan line outputs scan both the keyboard and displays.
PROCEDURES:
Keypad Control The 8279 scan line outputs SL0 , SL1 , and SL2 are connected to the keypad
through 74LS145 decoder. The 74LS145 is designed to accept BCD inputs and provide appropriate
outputs to drive 10-digit displays. Once a key is pressed, the input key is encoded by 8279 and
stored in its built-in FIFO RAM. After that, it sends the key code to the 8086 which consequently
sends it to the FND as shown in the following figure.
CODE SEGMENT
ORG 0
MOV DS,AX
MOV DX,CNTR79
MOV AL,0
OUT DX,AL
MOV AL,39H
OUT DX,AL
LOOP1: IN AL,DX
TEST AL,7
JZ LOOP1
MOV DX,DATA79
IN AL,DX
CALL OUT_FND
JMP LOOP_MAIN
MOV DX,FND
XLAT
OUT DX,AL
RET
FONT
DB 11000000B
DB 11111001B
DB 10100100B
DB 10110000B
DB 10011001B
DB 10010010B
DB 10000010B
DB 11011000B
DB 10000000B
DB 10010000B
DB 10001000B
DB 10000011B
DB 11000110B
DB 10100001B
DB 10000110B
DB 10001110B
DB 01000000B
DB 01111001B
DB 00100100B
DB 00110000B
DB 00011001B
DB 00010010B
CODE ENDS
END START
LCD Control The 16-by-2 LCD is controlled directly from 8086 microprocessor without
interfacing other I/O peripheral chips as shown in the following figure.
Utilize the following flow chart to write a code that causes the LCD to show the following message:
CODE SEGMENT
ORG 0
MOV DS,AX
MOV AH,1
CALL IRWR
MOV AH,84H
CALL IRWR
MOV AH,'O'
CALL OUTL
MOV AH,'H'
CALL OUTL
MOV AH,'-'
CALL OUTL
MOV AH,'-'
CALL OUTL
CALL IRWR
MOV AH,'Y'
CALL OUTL
MOV AH,'A'
CALL OUTL
MOV AH,'!'
CALL OUTL
MOV AH,'!'
CALL OUTL
HLT
MOV DX,IR_WR
MOV AL,AH
OUT DX,AL
RET
MOV AL,AH
RET
BUSY1: IN AL,DX
AND AL,80H
JNZ BUSY1
RET
CODE ENDS
END START
PRECAUTIONS: 1. Properly connect the microprocessor kit with power supply terminals.
3. Make sure that all the machine codes should be as per specified in the
program.
EXPERIMENT NO.13
AIM: Write a program to show Interfacing with 8253/8254.
THEORY: 8253 and 8254 are software programmable timer/counter designed for use with
Microcomputer systems for the generation of accurate time delays under software control instead of
setting up timing loops in software. They are nearly identical in function. The major differences are:
a) The maximum clock frequency for 8253 is 2.6MHz and for 8254 it is 8MHz.
b) 8254 only has a read-back feature, by which you can latch the count value at any instant.
8253/8254 PROGRAM:
Place the second from the top of dip switch at the top left corner of the board at right position:
OUT1
COUNT1 EQU 0FFDAH ; address to select 8253 counter 1
CSR EQU 0FFDEH ; address to select 8253 control word
CNT3 EQU 3FD6H ; address to select 8255 control word register (PPI –3)
APORT3 EQU 3FD0H ; address to select 8255 Port A
BPORT3 EQU 3FD2H ; address to select 8255 Port B
CPORT3 EQU 3FD4H ; address to select 8255Port C
FND EQU 3FF0H ; address to select Seven Segment Display
ORG 0
CODE SEGMENT ASSUME CS: CODE, DS: CODE
START:
MOV SP, 4000H ; Setup Stack Pointer
MOV AX, CS ; CS = DS
MOV DS,AX
MOV AX,0
MOV ES,AX ; Setup ES to ‘0’
MOV BX,2*4 ; Setup Vector Address of NMI to BX
MOV ES:WORD PTR[BX],OFFSET NMI ; To write IP in Vector Table
MOV ES:2[BX],CS ; To write CS in the Vector Table
MOV DX,CNT3 ; Address of control word register of 8255 to initialize
MOV AL,90H ; To set up ports as : A PORT = input, B and C PORT = Output
OUT DX,AL ; DX goes to the Address Bus and AL to the Data Bus
MOV DX,CPORT3 ; Outputting to C PORT all High
MOV AL,0FFH
OUT DX,AL
I8253:
MOV DX,CSR ; Initializing 8253
MOV AL,01110110B ; selecting Counter 1, LSB then MSB, Mode-3-Square WaveMode,
Binary Count
OUT DX,AL ; DX goes to the Address Bus and AL to the Data Bus
PRECAUTIONS: 1. Properly connect the microprocessor kit with power supply terminals.
3. Make sure that all the machine codes should be as per specified in the
program.
Q1.What is Microprocessor?
Ans: It is a program controlled semiconductor device (IC), which fetches, decodes and executes
instructions.
Q12 How many bits of Flag registers are used in 8086 microprocessor?
Ans: - 16 bits.
Q15 Which Segment is used to store interrupt and subroutine return address registers?
Ans: Stack Segment in segment register is used to store interrupt and subroutine return address
registers.
Q16 What is the position of the Stack Pointer after the PUSH instruction?
Ans: The address line is 02 less than the earlier value. It will be Decrement by 2.
2. Microprocessor is a/an _______ circuit that functions as the CPU of the compute
A. electronic B. mechanic C. integrating D. processing
3. Microprocessor is the ______ of the computer and it perform all the computational tasks
A. main B. heart C. important D. simple
22. The BIU prefetches the instruction from memory and store them in ________
A. queue B. register C. memory D. stack
28. LDs copies to consecutive words from memory to register and ___________
A. ES B. DS C. SS D. CS
33. Instruction providing both segment base and offset address are called _____
A. below type .B. far type C. low type D. high type
35. The microprocessor determines whether the specified condition exists or not by testing the
______
A. carry flag B. conditional flag C. common flag D. sign flag
36. The LES copies to words from memory to register and __________
A. DS B. CS C. ES D. DS
37. The _________ translates a byte from one code to another code
A. XLAT B. XCHNG C. POP D. PUSH
39. The 8086 fetches instruction one after another from __________ of memory
A. code segment B. IP C. ES D. SS
40. The BIU contains FIFO register of size 6 bytes called _____.
A. queue B. stack C. segment D. register
41. The ___________ is required to synchronize the internal operands in the processor CLK
Signal
A. UR Signal B. Vcc C. AIE D. Ground
43. The pin of minimum mode AD0- AD15 has _________ data bus
A. 4 bit B. 20 bit C. 16 bit D. 32 bit
44. The address bits are sent out on lines through __________
A. A16-19 B. A0-17 C. D0-D17 D. C0-C17
46. The functions of Pins from 24 to 31 depend on the mode in which _______ is operating
A. 8085 B. 8086 C. 80835 D. 80845
47. The RD, WR, M/IO is the heart of control for a __________ mode
A. minimum B. maximum C. compatibility mode D. control mode
50. In max mode, control bus signal So,S1 and S2 are sent out in ____________ form
A. decoded B. encoded C. shared D. unshared
51. The ___ bus controller device decodes the signals to produce the control bus signal
A. internal B. data C. external D. address
52. A _____ Instruction at the end of interrupt service program takes the execution back to the
interrupted program
A. forward B. return C. data D. line
53. The main concerns of the ___________ are to define a flexible set of commands
A. memory interface B. peripheral interface
54. Primary function of memory interfacing is that the _________ should be able to read from
and write into register
A. multiprocessor B. microprocessor C. dual Processor D. coprocessor
57. The Microprocessor places 16 bit address on the add lines from that address by _____
register should be selected
A. address B. one C. two D. three
58. The ________of the memory chip will identify and select the register for the EPROM
A. internal decoder B. external decoder C. address decoder D. data decoder
59. Microprocessor provides signal like ____ to indicate the read operatio
A. LOW B. MCMW C. MCMR D. MCMWR
60. To interface memory with the microprocessor, connect register the lines of the address bus
must be added to address lines of the _______ chip.
A. single B. memory C. multiple D. triple
61. The remaining address line of ______ bus is decoded to generate chip select signal
A. data B. address C. control bus D. both (a) and (b)
64. _____ has certain signal requirements write into and read from its registers
A. memory B. register C. both (a) and (b) D. control
66. The primary function of the _____________ is to accept data from I/P devices
A. multiprocessor B. microprocessor C. peripherals D. interfaces
67. ___________ signal prevent the microprocessor from reading the same data more than one
80. In 8086 microprocessor the following has the highest priority among all type interrupts?
A. NMI B. DIV 0 C. TYPE 255 D. OVER FLOW
86. Which of the following is not a basic element within the microprocessor?
A. Microcontroller B. Arithmetic logic unit (ALU)
C. Register array D. Control unit
87. Which method bypasses the CPU for certain types of data transfer?
A. Software interrupts B. Interrupt-driven I/O
C. Polled I/O D. Direct memory access (DMA)
98. Which microprocessor accepts the program written for 8086 without any changes?
A. 8085 B. 8086 C. 8087 D. 8088