You are on page 1of 24

G.H.

RAISONI COLLEGE OF ENGINEERING, NAGPUR


Department of Electronics and Communication Engineering
Branch: -8thSemester [Electronics]
Subject: - Advanced Microprocessors & Microcontroller

List Of Experiments
___________________________________________________________________

1) Study of 8086 and basic programs.


2) Write a program to arrange a given string in ascending / descending order.
3) Write a program to multiply two matrices.
4) Write a program to compare a given string by using string related instruction.
5) Write a program to design a digital clock to display Hrs, Min & sec.
6) Write a program “GHRCE” on monitor screen by using DOS functions.
7) Interface following ICs with 8086
a) 8255: Write a program to generate square wave on 8255 port and use logic
analyzer to observe it
b) Digital to Analog Converter: Write a program to generate given waveform.
8) Interface 8086 with 8251. Set the 8251in asynchronous mode as a transmitter
& receiver with even parity enabled, 2 stop bits, 8-bit character length, with
given frequency & baud rate.
a) Write a program to transmit 100 bytes of data string starting at location
DS: 2000h.
b) Write a program to receive 100 bytes of data string and store it at ES:
3000h
9) Study of 8051 Microcontroller & basic programs. Introduction to Keil
Compiler.
10) Write a program to display “WELCOME GHRCE”.
11) Write a program for serial data transmission by using serial port of 8051.
12) Write a program to generate a delay of 1 Sec. By using Timer0 of 8051 in
mode2.
13) Interface LCD display with 8051 & WAP to display “Message” on it.
14) Write a program to identify smallest / largest number from given string
of 10 bytes data.

15) Write a program to sort out even and odd numbers from given data
string.

16) Write a program to sort out positive and negative numbers from given
data string.

17) Write a program to perform addition of two matrices.


18) Interfacing of 8086 with 8251.
19) Write a program to find the given byte from a string using string
related instructions.
20) Interface 8253 timer IC with 8086 and write a program to ring the
buzzer after a delay of 2 Min.
21) Interface 8279 with 8086 to read the character from keyboard and
display it on 7-segment display.
Experiment No.- 1

Aim: Study of 8086 processor and basic programs.

Problem: Write a sample program for


1) Addition of Two 16-bit numbers.
2) To find smallest no. from a given string.

Tools Required: MASM, 8086 Kit

Theory:
The 8086 is a 16-bit processor having 20 address lines, 16- Data lines & 8-bit
as well as 16-bit registers is as follows
1) General purpose registers: AX (AH-AL), BX (BH-BL), CX (CH-CL), DX
(DH-DL).
2) Flag register.- 9-Bit Flag
3) Segment & offset registers- CS, DS, SS, ES these are four segment
registers. SI, DI, BP, SP, IP & BX these are offset registers.
4) Segmentation of memory: Memory of 8086 is divided into different
segments. One segment having maximum capacity of 64Kb, so max. 16
segments are there.
At a time four segments can be activating, these are code segment, data
segment, stack segment & Extra segment.

1. Software Suit, which is used for Practical, is MASM (Micro Assembler)


It is DOS based software suit, so we have to work with DOS prompt.

2. It consist of following application files:

i) Editor (Norton Editor (NE))


ii) Assembler (MASM)
iii) Linker (LINK)
iv) Debugger (AFDEBUG)

I) Editor:

It is a software tool, which allowed user to write its source code in


assembly language and save the assembly file by using .ASM extension. All
application programs are copied into D drive under the folder name MASM.
To enter into Norton editor use following command on DOS prompt.

D:\masm>NE (Press Enter Key)

Enter the File Name with .ASM extension (eg. Program1.asm) Write a
program in editor window with the help of assembler directives
II) Assembler:

It is a software tool, which is used to convert source code (.ASM) into object
code (.OBJ). Use following command

D:\masm>MASM filename.asm (Press Enter key 4-times)

Eliminate all sever error then proceed for next steps.

III) Linker:

Once source code is assembled, the resulting object file is passed to the linker.
At this point, the linker may combine several object files into an executable
program. The linker:
1) Combines segments according to the instructions in the object files,
rearranging the positions of segments that share the same class or group.
2) Fills in placeholders for offsets (relocatable addresses).
3) Writes relocations for segments into the header of .EXE files
4) Writes the result as an executable program file.

D:\masm>LINK filename.obj (Press Enter key 4-times)

IV) Debugger:

It is a software tool, which is used to load the .EXE file in RAM memory
location and execute it in single stepping mode.

D:\masm>AFDEBUG (Press Enter key 2-Times)

There you will observe command prompt of debug window i.e. CMD
Use different command for different operation. Press F4 key to view different
command. (e.g. L operator is used to load the .EXE file to executable window)
Execute the program by pressing F1 key.

Sample Program:

Step-1: Initialize the data memory segment where two 16-bit data are present.
Step-2: Fetch 1st 16-bit data into any 16-bit general-purpose register (GPR).
Step-3: Add the content of GPR and 2nd word (16-bit data) of data memory.
Step-4: Observe 16-bit LSB result in GPR and carry status in CF.
Step-5: Terminate the program by using DOS interrupt.

Conclusion:

The 8086 have been studied and the result of sample program is observed as
follows.
Viva Questions:

1) Explain the addressing modes of 8086 in brief.


2) What is assembler directive? Explain assembler directives of 8086
3) Explain general-purpose register of 8086.
4) Explain how physical address is formed in 8086.
Experiment No. - 2
Aim: Write a program to arrange a given string in ascending / descending order.
Problem: The data string of 5 bytes is present in a data memory from location
DS: 6000. Arrange the given string in ascending/ descending order in same
memory location (Data Given: 6aH, 78H, 0abH, 8cH, 0daH)

Tools Required: MASM, 8086 Kit

Theory:
For arranging a given string in Ascending/Descending order first decides
which algorithm/method we have to use. (e.g. Bubble Sort)
By comparing 1st data of memory with rest of the data, we can identify either
1st largest or 1st smallest byte. Place this byte at last address of data memory.
Repeat the same procedure or identification of next smallest or largest byte
and arrange this byte above the 1st one. Repeat the same procedure up to last
byte. Use LEA instruction for offset.

Procedure:

Step-1: Initialize the data memory segment from specified address.


Step-2: Initialize the outer counter (counter-1) for repetitive action of finding
smallest / largest no. among the string.
Step-2: Fetch 1st data from data memory location into any general-purpose
register (GPR).
Step-3: Initialize the inner counter (counter-2) for identification of 1st smallest
/largest no. among the string.
Step-4: Increment data memory offset & compares data of memory with GPR.
Step-5: Check the status of carry flag & swap the content of two memories
depend upon requirement.
Step-6: Decrement inner counter & check zero flag for 1st largest / smallest
no. If ZF=0, repeat from step 4. If ZF=1 then decrement outer counter
& check again ZF, whether the ring is arrange in ascending /
descending order. If ZF=0, then repeat the procedure from step-2.
Step-6: If ZF=1 then terminate the program by using DOS interrupt.

Conclusion:

The given data string is arranged in ascending/descending order and the result
of program is observed as follows.

Viva Questions:

1. Explain importance of condition flag in 8086.


2. What are the advantages of segmentation?
3. Is overlapping of segment possible in 8086?
Experiment No. - 3

Aim: Write a program to multiply two matrixes.


Problem: Multiply two matrices of 3 X 2 and 2 X 3 and stored the resultant matrix
from location ES:8000H

Tools Required: MASM, 8086 Kit

Theory:

The given matrices cannot be stored in the forms of Rows & Columns.
Logically decide the data of matrices (Element) is stored in Row fashion or
Column fashion. In this program steps are given in Row fashion. The elements
of matrix are stored in consecutive memory location as a row element. So
according requirement of element of matrix1 and matrix2 offset is calculated
and perform multiplication using MUL instruction.

Procedure:

Step-1: Initialize the counter for no. of rows in Matrix1 (C3)


Step-2: Initialize the offset addresses for matrices. (Matrix1, Matrix2 and
Resultant Matrix)
Step-3: Initialize the counter for no. of columns in Matrix2 (C2)
Step-4: Initialize 16-bit register (R1) for storing the result of row-column
multiplication and counter for no. of elements in single row of Matrix1
(C3)
Step-5: Fetch data of matrix1 into AL register
Step-6: Multiply content of AL register with 1st data of Matrix2
Step-5: Add the content of R1 and AX & stored result in R1.
Step-6: Increment offset of Matrix1 and Matrix2 according to logic.
Step-6: Decrement element counter (C3) and check zero flag. If ZF=0 then
jump to step-5
Step-7: Store the content of R1 register into destination memory location &
increment offset of destination offset register by 2.
Step-8: Calculate offset for matrix1 (Same Row) and matrix2 (Next Column)
according to logic.
Step-9: Decrement counter for column of Matrix2 (i.e. C2) and check zero
flag. If ZF=0 then jump to step-4.
Step-10: Calculate offset for next row of Matrix1.
Step-11: Decrement row counter of Matrix1 (i.e. C1) and jump to Step-3 if
ZF=0.

Conclusion:

The given matrices have been multiplied and the resultant matrix is observed
as follows.
Viva Questions:

1. Explain Loop instruction of 8086.


2. Explain assembler directive PTR.
3. Explain status signals in 8086.
Experiment No. - 4

Aim: Write a program to compare a given string by using string related instruction.
Problem: Two strings are present from logical addresses 5000:2500h and
6000:2500h in DMS and EMS respectively. Compare the strings and if found
equal, load register BL with FFh otherwise load 00h.

Tools Required: MASM, 8086 Kit

Theory:

Assume that the strings contain 10 characters each. Using string compare
instruction go on comparing individual characters until characters are
matching. If end of string is reached in that way, the strings are equal
otherwise at any point if match not found then the strings are not equal.

Procedure:

Step-1: Store the given strings from the offset addresses 2500h and 2500h in
DMS and EMS respectively.
Step-2: Initialize the data memory segment and Extra memory segment from
specified address.
Step-3: Load register CL with the count value.
Step-4: Load the effective addresses in SI and DI registers respectively.
Step-5: Using CMPSB instruction to compare individual character from DMS
and EMS.
Step-6: Check whether ZF=1. If ZF=1, then go to next step otherwise go to
step 8.
Step 7: Decrement the count value from register CL. Check whether the count
is zero. If it is zero then load register BL=FFh and terminate otherwise
go to step 5.
Step 8: Load register BL=00h and terminate.

Conclusion:

If the given strings matches the value of register BL is found to be FFh


otherwise BL=00h

Viva Questions:

1. Differentiate between CMPSB and CMPSW instructions.


2. Write the same program using conditional REPEAT instruction.
3. Explain the significance of DF (Direction Flag) for string instruction.
Experiment No. - 6

Aim: Write a program to display “GHRCE” on monitor screen by using DOS


functions.
Problem: The string to be displayed is stored from memory logical address
5000:2000.

Tools Required: MASM, 8086 Kit

Theory:

The given string has to be stored from memory address 5000:2000h


terminated by an ASCII value ‘$’(End of the string). The characters 0Ah and
0Dh can be used as the line feed and carriage return characters. The offset
address has to be loaded in register DX and the dedicated interrupt INT 21h is
used to display the given string from the offset address. The argument that is
required for this function is a byte 09h, which must be loaded in, register AH
for displaying the message on the CRT Screen. After the message is displayed
the control is transferred to DOS prompt.

Procedure:

Step-1: Store the given string fro the offset address 2000h.
Step-2: Initialize the data memory segment from specified address.
Step-3: Set the function value for the display AH=09h.
Step-4: Load the offset address in register DX.
Step-5: Invoke the interrupt INT 21h.
Step-6: Return to DOS.

Conclusion:

The given data string is displayed on the screen which is the output of the
program.

Viva Questions:

1. What are various services that are provided by INT 21h interrupt?
2. Why it is necessary to terminate a given string by ‘$’?
3. What is the ASCII value of ‘$’?
Experiment No. - 7

Aim: Interface following IC’s with 8086


a) 8255: Write a program to generate square wave on 8255 port and use logic
analyzer to observe it
b) Digital to Analog Converter: Write a program to generate given waveform.
Problem: 1) Interface 8255 IC with 8086 kit from addresses 40H. Generate square
wave on port A of 8255 with duty cycle of 60%.

Tools Required: MASM, 8086 Kit, DAC Card

Theory:
The 8255 is called as a PPI (Programmable Peripheral Interface), which is
used as a mediator between processor and input/output devices. It has three 8-
bit port i.e. Port A (PA) and Port B (PB) & Port C (PC). Port C can be
configure in two 4-bit port i.e. Pcupper & Pclower. It has different controlling
signals ie. RD, WR, CS are low-level active signals and A0, A1 & Reset are
high-level active signal.

Procedure:

Step-1: Interface 8255 Ad-on card with 8086 kit and Port A pin with Logic
analyzer
Step-2: Initialize the Control Word Register (CWR) in I/O mode
Step-3: Transfer 00H on Port A by using OUT instruction
Step-3: Call a delay of Toff time period (40% of total time)
Step-4: Transfer FFH on port A & call a delay of Ton time period (60% of
Total Time).
Step-5: Use unconditional jump and repeat the sequence from step-3

Conclusion:

The square wave has been observed on Logic analyzer with duty cycle of 60%

Viva Questions:

1. Explain the basic modes of 8255.


2. Which ports can be used in Mode-1?
3. What is clock frequency of 8086 processor given on kit?
4. Explain Mode-1 of 8255.
Experiment No. - 9

Aim: Study of 8051 Microcontroller & basic programs. Introduction to Keil


Compiler.
Problem: Register A has packed BCD; write a program to convert packed BCD to
Two ASCII numbers and place them in R2 and R6

Tools Required: UMPS, Keil compiler

Theory:
8051 is an 8-bit microcontroller. It has following features
1) Four 8-bit ports, which are bit addressable,
2) 128 bytes on chip RAM,
3) 4K ROM,
4) Two timer of 16-bit each
5) One serial port
Keil compiler is used for writing a program in ‘C’ language also can rite in
assembly
Sample Program:
Procedure:
Step-1: Take BCD number in register A.
Step-2: Keep copy of BCD data in register R2.
Step-3: Mask the upper nibble; make it an ASCII, save it in R6.
Step-4: Get original data and mask lower nibble.
Step-5: Rotate the content by four bits towards right.
Step-6: convert it into ASCII and it in R2.

Conclusion:

The study of 8051 & Keil compiler has been completed. The result of sample
program is as shown below.

Viva Questions:

1. Which is the general purpose registers in 8051?


2. What is operating frequency of 8051?
3. What is special function register? Explain its importance.
4. What are the addresses of RAM, reserved for bit addressable?
Experiment No. - 11

Aim: Write a program for serial data transmission by using serial port of 8051
Problem: Write a program to transfer a message “WELCOME GHRCE” serially a
9600 baud, 8-bit data, 1-stop bit. Do this continuously.
Tools Required: UMPS, Keil compiler

Theory:
To perform serial transmission, we have to use serial port. The baud rate is a
unit of data transmission in bits/sec. The SCON register is an 8-bit register
used to program the start bit, sop bit and data framing, among other things.
SBUF is a serial buffer register to store transfer or receive data.
Procedure:
Step-1: Load TMOD register with value 20H. (Set Timer-1, in mode-2).
Step-2: TH1 is loaded with value to se baud rate
Step-3: Initialize SCON register.
Step-4: TR1 is set to 1 to start timer1, clear TI.
Step-5: The character byte to be transferred serially is written into the SBUF
register
Step-6: Monitor TI bit to check whether character has been transferred or not.
Step-7: To transfer next characters go to step-4.

Conclusion:

The given character string is transfer serially with the given baud rate.

Viva Questions:
1) What is baud rate?
2) What is importance of TI flag?
3) In how many modes serial port is operated in 8051?
4) Explain SCON register.
Experiment No. - 12

Aim: Write a program to design to generate a delay of 1 second Mode 2.

Problem: The delay of 1 second is to be monitored on port 1 pin p1.0 which


connects an LED and is made off and on per second.

Tools Required: UMPS, Keil compiler

Theory:

Mode 2 is the auto reload mode of the timer. In this mode initially the TMOD
register is loaded with the value needed and the count is loaded in THx
register. When the timer is started (TRx) the count value (TLx) is
automatically loaded into TLx register and the counter starts incrementing
(Up-counter). We monitors the timer flag bit TFx. When it becomes 1 we clear
it and same procedure is repeated for the same count, which is reloaded
automatically from the THx, register. For one cycle we complement the bit
P1.0. We use the standard input frequency for 8051 Microcontroller – 11.0592
MHz. This crystal frequency is internally divided by 12 to give
T=1.085µsec.(Time for one clock cycle)

Procedure:

Step-1: Set initial value for the port bit P1.0.


Step-2: Load the TMOD register.
Step-3: Load the count in THx register.
Step-4: Initiate the Timer Run Register.
Step-5: Check the timer Flag. If it is 1 complement the port bit P1.0 otherwise
keep monitoring the TF flag bit.
Step-6: Clear the TF bit and jump to step 5.

Conclusion:

The program was executed and found that the LED connected to port bit P1.0
blinked every 1-second.

Viva Questions:

1. What is the significance of Timer Mode 2?


2. Why an odd frequency value is selected for 8051 Microcontroller?
3. Can we change the value of T=1.085 µsec? How?
Experiment No. - 13

Aim: Write a program to display “Microcontroller” on LCD display.

Problem: Interface LCD display with 8051 and display “Microprocessor” in the
first line of the display.

Tools Required: UMPS, Keil compiler

Theory:
In recent years the LCD is finding widespread use replacing LED’s. This is
due to the following reasons
1. Declining prices
2. Ability to display numbers, characters and graphics.
3. Incorporation of a refreshing controller into the LCD.
4. Ease of programming.
5. The following pins are important to LCD’s while programming

i) RS:-Register Select. If RS=0, the instruction command code


register is selected. If RS=1, the data register is selected.
ii) R/W:-Read/Write.For R/W=0/1, then the LCD can be written
into/read.
iii) E:-Enable.A H-to-L pulse is required at this pin to latch the data
present on the data pins.

Procedure:

Step-1: Initiate a pointer (DPTR) to point the string “Microprocessor” (say


from memory location 2000h)
Step-2: Set a counter for 14 characters. (Say R1)
Step-3: Initialize 2 lines 5x7 matrix. (Load 38h into command register)
Step-4: Make LCD on and Cursor on. (Load 0Eh into command register)
Step-5: Set the cursor at the beginning of the first line. (Load 80h in command
register)
Step-6: Take a character from memory into A and send it on the display.(Use
data register)
Step-7: Increment the pointer DPTR for next character.
Step-8: Decrement the counter R1 and check whether it is zero.
Step-9: If not zero jump to step 6 and if zero stop.

Conclusion:
The program was executed and found that the LCD display showed the string
“Microcontroller” in the first line.

Viva Questions:

1. List some LCD command codes.


2. What are the steps that should follow when writing data and writing
command?
Experiment No. – 14

Aim: Write a program to identify smallest / largest number from given string
of 10 bytes data.
Problem:
The data string of 10 bytes is present in a data memory from location
DS: 6000. Find the smallest / largest number. (Data Given: 6aH, 78H,
0abH, 8cH, 0daH, 45H, 70H, 90H, 05H, 60H)

Tools Required: MASM, 8086 Kit

Theory:

Compare the ith number of the series with the (i+1)th number using CMP instruction.
It will set the flags appropriately depending upon whether the ith number or the
(i+1)th number is smallest / largest number. If the ith number is greater/smaller than
(i+1), leave it in AX (any register may be used). Otherwise, load the (i+1) th number
in AX, replacing the ith number in AX. The procedure is repeated till all the numbers
in the array have been compared.

Procedure:

Step1: Initialize the data memory segment


Step2: Initialize the memory pointer.
Step3: Fetch the 1st byte into accumulator (general purpose register)
Step4: Compare next byte with the previous one, and check the carry flag
Status. If CF=1 then exchange the content of memory. If CF=0 then
kept as it is.
Step5: Increment pointer to the byte list and decrement counter.
Step6: If all numbers are compared, point to result destination and store it.

Conclusion:
The smallest / largest number has been identified from the given string and the
result of program is observed as follows.

Viva Questions:

1. What is the function of NMI pin?

2. What is the function of READY pin?

3. What is the function of TEST pin?

4. What is the function of BHE/S7 pin?


Experiment No. – 15

Aim: Write a program to sort out even and odd numbers from given data
string.

Problem: The data string of 10 bytes is present in a data memory from location
DS: 6000. Sort out even and odd numbers from given data string and
store the numbers in same memory location (Data Given: 00H, 90H,
34H, 50H, 78H, 6aH, 78H, 0abH, 8cH, 0daH)

Tools Required: MASM, 8086 Kit

Theory:

For identifying even and odd number from given string of 10 bytes data, first decides
which algorithm/method we have to use.
The simplest logic to decide weather a binary number is even or odd, is to check the
least significant bit of the number. If the bit is zero, the number is zero or the number
is odd. Check the LSB by rotating the number through carry flag, and increment even
or odd number counter.

Procedure:
Step1: Initialize the data memory segment
Step2: Initialize the memory pointer.
Step3: Rotate the contents of accumulator right with carry and check the least
significant bit of the number
Step 4: If the bit is zero, the number is zero or the number is odd.
Step 5: Check the LSB by rotating the number through carry flag, and
increment even or odd number counter.

Conclusion:
The even and odd numbers has been identified from the given string and the
result of program is observed as follows.

Viva Questions:

1. How DF = 1 works?

2. How DF = 0 works?

3. What is the difference between LDS and LES?

4. What is the difference between LAHF and SAHF?


Experiment No. – 16

Aim: Write a program to sort out positive and negative numbers from given
data string.

Problem: The data string of 10 bytes is present in a data memory from location
DS: 9000. Sort out positive and negative numbers from given data
string and store the numbers in same memory location.

Tools Required: MASM, 8086 Kit

Theory:
For identifying positive and negative number from given string of 10 bytes data, first
decides which algorithm/method we have to use. Take the ith number in any of the
registers. Rotate it left through carry. The status of carry flag, i.e. the most
significant bit of the number will give the information about the sign of the number.
If CF is 1, the number is negative otherwise it is positive.

Procedure:

Step1: Initialize the data memory segment


Step2: Initialize the memory pointer.
Step3: Take the number in any of the register.
Step4: Rotate it left through carry.
Step5: Check the status of the carry flag.
Step6: Check the most significant bit of the number, if CF is 1, the number is
negative otherwise it is positive.

Conclusion:
The positive and negative numbers has been identified from the given string
and the result of program is observed as follows.

Viva Questions:

1. What is a bus cycle?

2. What is the function of DEN?

3. What is the function of S2, S1, and S0?

4. What is the function of AND, OR, XOR instructions?


Experiment No. – 17

Aim: Write a program to perform addition of two matrices.

Problem: Write a program to perform addition of two 3*3 matrices. The matrices
are stored in the form of list (row wise). Store the result of addition in
the third list.

Tools Required: MASM, 8086 Kit

Theory:
In the addition of two matrices, the corresponding element is added to form the
corresponding elements of the result matrix.
The matrix A can be stored in memory at an offset MAT1, such as a11, a12, a13,
a21, a22, a23, a31, a32, a33 etc. The second matrix B can be stored in memory at an
offset MAT2, such as b11, b12, b13, b21, b22, b23, b31, b32, b33 etc. A total of
3*3=9 additions are to be done.

Procedure:
Step1: Initialize the data memory segment.
Step2: Initialize both the matrices A and B.
Step3: The matrix A can be stored in memory at an offset MAT1, and the
second matrix B can be stored in memory at an offset MAT2
Step4: The corresponding element is added to form the corresponding
elements of the result matrix.

Conclusion:
The given matrices have been added and the resultant matrix is observed as
follows.

Viva Questions:

1. What is the function of NOT and NEG instructions?

2. What is the function of TEST instruction? On which register it is


effective?

3. What is the function of MUL & IMUL?

4. What is the function of DIV & IDIV?


Experiment No. – 18

Aim: Interfacing of 8086 with 8251.

Problem: Interface 8086 with 8251. Set the 8251in asynchronous mode as a
transmitter & receiver with even parity enabled, 2 stop bits, 8-bit
character length, with given frequency & baud rate.
a. Write a program to transmit 100 bytes of data string starting at location
DS: 2000h.
b. Write a program to receive 100 bytes of data string and store it at
ES:3000h

Tools Required: MASM, 8086 Kit, 8251 interfacing card

Theory:
The 8251 can be programmed to operate in its various modes using its mode control
words. A set of control words is written into the internal registers of 8251 to make it
operate in the desired mode. The control words of 8251 are divided into two
functional types as Mode Instruction control word and Command Instruction control
word. For interfacing connections of 8251 with 8086, set asynchronous mode control
word as 0FEH as for given information.

Procedure:
Procedure to transmit 100 bytes of data:
Step 1: Initialize data segment register.
Step 2: Initialize counter.
Step 3: Out mode control word 0FEH to D0-D7.
Step 4: Load command word to transmit enable and error reset and read
status.
Step 5: Check transmitter enable bit, if zero wait for the transmitter to be
ready.
Step 6: If ready, first byte of string data is transmitted and point to next byte.
Step 7: Decrement counter.
Step 8: If counter is not zero, go for next byte and if counter is zero then
return to DOS.

Procedure to receive 100 bytes of data:


Step 1: Calculate command instruction word as 14H
Step 2: Initialize data segment.
Step 3: Initialize counter.
Step 4: Load command word to enable the receiver and disable transmitter.
Step 5: Read status and check FE, 0E and PE. If it is zero then check
RXRDY. If the receiver is not ready then wait. If it is ready then
receiver the character.
Step 6: If it is not zero, clear them.
Step 7: Increment pointer to next byte and decrement counter.
Step 8: Repeat if counter is not zero and if counter is zero then return to
DOS.
Conclusion:
The data has been transferred and received correctly.

Viva Questions:

1. What are the interrupt vector addresses of the following interrupts in the 8086
IVT?
a. INTO
b. NMI
c. INT 20H
d. INT 55H

2. What is the difference between hardware and software interrupt?

3. What is the difference between Microprocessor and Microcontroller?

4. Is 8051 Microcontroller 8-bit or 16-bit?


Experiment No. – 19

Aim: Write a program to find the given byte from a string using string
related instructions.

Problem: Write a program to find out whether a given byte is in the string or not.
If it is in the string, find out the relative address of the byte from the
starting location of the string.

Tools Required: MASM, 8086 Kit

Theory:

The given string is scanned for the given byte. If it is found in the string, the zero flag
is set, else it is reset. Use of the SCASB instruction is quite obvious here. A count
should be maintained to find out the relative address of the byte found out.

Procedure:

Step1: Initialize the data segment.


Step2: Initialize the counter.
Step3: For the given byte which we want to search, the given string is
scanned.
Step4: If the byte is found in the string, the zero flag will set, otherwise it will
reset.
Step5: If the byte will found, store the relative address of the byte.

Conclusion:

The given number has been identified from the given string and the result of
program is observed as follows.

Viva Questions:

1. Explain the different string related instructions.

2. Can string related instructions support for direct memory transfer?

3. Which is default register used as counter in string related instructions.


Experiment No. – 20

Aim: Interface 8253 timer IC with 8086 and write a program to ring the
buzzer after a delay of 2 Min.

Problem: Design a programmable timer using 8253 and 8086. Interface 8253 at
an address 0040H for counter 0 and write the program to generate a
square wave of period 1ms.

Tools Required: MASM, 8086 Kit, 8253 card.

Theory:

Neglecting the higher order address lines (A16-A8), the 8253 is interfaced with lower
order data bus (d0-D7), hence A0 is used for selecting the even bank. The A0 and A1
of the 8253 are connected with A1 and A2 of the processor. The counter address can
be decoded as 40H for Counter 0, 42H for Counter 1, 44 for Counter 2, 46H for
Control word register.
For generating a square wave, 8253 should be used in mode 3. Let us select counter 0
for this purpose that will be operated in BCD mode. Now suitable count is to be
calculated for generating 1ms time period.

Procedure:

Step 1: Initialize 8253 by initializing control word register.


Step 2: Use counter 0 in mode 3.
Step 3: Write 00 decimal in LSB of count register and 15 decimal in MSB as a
count.
Step 4: Start the timer.

Viva Questions:
1) What is the use of Interrupts in any system?

2) What is the capacity of Internal RAM in 8051?

3) What is use of TR0 and TR1 in 8051?

4) How the Timer can be used as a Counter?


Experiment No. – 21

Aim: Interface 8279 with 8086 to read the character from keyboard and
display it on 7-segment display.

Problem:

Interface keyboard and display controller 8279 with 8086 at addresses 0080H. Write
an ALP to set up 8279 in scanned keyboard mode with encoded scan, N-key rollover
mode. Use a 16-character display in right entry display format. Then clear the
display RAM with zeroes. Read the FIFO for key closure. If any key is closed, store
its code to register CL. Then write the byte 55 to all the displays and return to DOS.
The lock input to 8279 is 2MHz, operate it at 100 kHz.

Tools Required: MASM, 8086 Kit, 8279 interfacing card.

Theory:

The 8279 is interfaced with lower byte of the data bus, i.e. D0-D7. Hence the A0
input of 8279 is connected with address line A1. The data register of 8279 is to be
addressed as 0080H, i.e. A0=0. For addressing the command or status word A0 input
of 8279 should be 1 (the address line A1 of 8086 should be 1), i.e. the address of the
command word should be 0082H.

Procedure:

Step1: Set 8379 command words according to program i.e. Keyboard/Display


Mode Set CW, Program clock selection, Clear Display RAM, Read
FIFO, Write Display RAM commands.
Step2: Read FIFO command for checking display RAM.
Step3: Wait for clearing of Display RAM by reading FIFO Du bit of the status
word i.e. if Du bit is not set wait, else proceed.
Step4: Read FIFO command for checking key closure, also read FIFO status.
Step5: Mask all bits except the number of characters bits. If any key is
pressed, take required action; otherwise proceed to write display RAM
by using write display command.
Step 6: Write the byte 55H to all display RAM locations.
Step 7: Call routine to read the key code of the pressed key is assumed
available.

Viva Questions:
1) What addressing mode is used the following instruction
a) MOV AX, BX c) MOV AX, [DI]
b) MOV [SI + BP] d) MOV CX, 2342H

2) What is wrong with a MOV [BX], [DI] instruction?

3) What is wrong with a MOV AX, DL instruction?

You might also like