You are on page 1of 40

MULTI BYTE ADDITION & SUBTRACTION

EXPT. NO: 1
DATE:

1. AIM: Write an ALP in 8086 to implement Multi byte addition & subtraction.
2. COMPONENTS & TOOLS REQUIRED:
2.1 Personal Computer,
2.2 TASM Software
3. THEORY: Generally 8-bits are called a byte, 16-bits are called a word, 32-bits are called a
double word. The data more than 4 bytes is called a multi byte. Here, we are adding two multi
bytes which are stored at different locations. By using the instruction ADC, we can add byte by byte
with Carry. We can use SUB, SBB instructions for subtraction.

4(a). PROGRAM (for Addition):

Lingayas Institute of Management and Technology, Madalavarigudem, Vijayawada-521212.

5(a). RESULTS (for Addition):


INPUT

OUTPUT

4(b). PROGRAM (for Subtraction):

Lingayas Institute of Management and Technology, Madalavarigudem, Vijayawada-521212.

5(b). RESULTS (for Subtraction):


INPUT

OUTPUT

6. CONCLUSION:

7. VIVA -VOCE QUESTIONS:


1. What is a multi byte?
2. Which registers are used as pointers?
3. On what condition the carry flag is set?
4. What are the commands to perform this program on the kit?
5. What is the difference between conditional and unconditional jump instructions?
6. What are the flags available in 8086?

MULTIPLICATION & DIVISION

EXPT. NO: 2
DATE:

1. AIM: Write an ALP in 8086 to implement Multiplication & Division (unsigned & signed).
2. COMPONENTS & TOOLS REQUIRED:
Lingayas Institute of Management and Technology, Madalavarigudem, Vijayawada-521212.

2.1 Personal Computer,


2.2 TASM Software
3. THEORY:
In 8086, direct instruction is available to multiply two 8 bit or two 16 bit numbers. But where as
in 8085 the direct instruction is not available to multiply two 8 bit or two 16 bit numbers. After
multiplication, if it is 16 bit multiplication, the result will be stored in AX and DX registers and if it is
8 bit multiplication, the result will be stored in AX register. For signed numbers we have to use
IMUL instruction.
After division, if it is 16 bit / 8 bit, the quotient will be stored in AL and reminder will be stored
in AH register and if it is 32 bit / 16 bit division, the quotient is stored in AX register and the
remainder is stored in DX register. For signed numbers we have to use IDIV instruction.
4(a). PROGRAM: MULTIPLICATION (UNSIGNED)

5.1 RESULTS:
INPUT

OUTPUT

Lingayas Institute of Management and Technology, Madalavarigudem, Vijayawada-521212.

MULTIPLICATION (SIGNED)

5.2 RESULTS:
INPUT

OUTPUT

4(b). PROGRAM: DIVISION [32-BIT / 16-BIT] (UNSIGNED)

Lingayas Institute of Management and Technology, Madalavarigudem, Vijayawada-521212.

5.1 RESULTS:

INPUT

OUTPUT

DIVISION [32-BIT / 16-BIT] (SIGNED)

Lingayas Institute of Management and Technology, Madalavarigudem, Vijayawada-521212.

5.2 RESULTS:

INPUT

OUTPUT

6. CONCLUSION:

7. VIVA -VOCE QUESTIONS:


1. What are the commands to perform this program on the kit?
2. What is the range of 8 bit signed numbers?
3. What is the range of 16 bit signed numbers?
4. In which registers the 32 bit result will be stored after multiplicdation?
5. What is the name of the instruction for signed multiplication?
6. What type of segments are used in 8086?
7. In which registers the QUOTIENT AND REMINDER after DIVISION?
8. What is the name of the instruction for signed division?
9. How many units the 8086 architecture consists of?

Lingayas Institute of Management and Technology, Madalavarigudem, Vijayawada-521212.

ADDITION & SUBTRACTION OF TWO ASCII NUMBERS

EXPT. NO: 3
DATE:

1. AIM: Write an ALP in 8086 to implement addition and subtraction of two ASCII numbers.
2. COMPONENTS & TOOLS REQUIRED:
2.1 Personal Computer,
2.2 TASM Software
3. THEORY: Generally, when you press a key on keyboard the keys will be encoded in the form of
ASCII codes. So we need to know the arithmetic operations of ASCII numbers.
For ex: The ASCII value of 0 is 30, ASCII value of 1 is 31 and so on. The ASCII value of a is 41,
ASCII value of b is 42 and so on. When we deal with ASCII arithmetic operations, we should
through with the ASCII related instructions like AAA and AAS. AAA is ASCII Adjust after addition.
AAS is ASCII Adjust after subtraction

Lingayas Institute of Management and Technology, Madalavarigudem, Vijayawada-521212.

4(a). PROGRAM (for ASCII Addition):

5. RESULTS:

INPUT

OUTPUT

4(b). PROGRAM (for ASCII Subtraction):

Lingayas Institute of Management and Technology, Madalavarigudem, Vijayawada-521212.

5. RESULTS:

INPUT

OUTPUT

6. CONCLUSION:

7. VIVA -VOCE QUESTIONS:


1. What are the commands to perform this program on the kit?
2. What is the ASCII value of C?
3. To which numbers the keyboard keys are encoded?
Lingayas Institute of Management and Technology, Madalavarigudem, Vijayawada-521212. 10

4. What is the way to convert an ASCII number into Hex number?


5. How we convert from Hex number to ASCII number?
6. Is there any difference in the ASCII numbers of Capital letters and Small letters?
7. What is AAA instruction?
8. What is AAS instruction?

SHIFT & ROTATE

EXPT. NO: 4
DATE:

1. AIM: Write an ALP in 8086 to implement Shift and Rotate operations.


2. COMPONENTS & TOOLS REQUIRED:
2.1 Personal Computer,
2.2 TASM Software
3. THEORY: Shift and rotate operations are the bit wise logical operations. If we want to shift one
bit only directly we can write SHL Al, 01H. If we want to shift more than one bit we have to use the
counter CL. The same case is applicable for rotate operations. We can use these instructions
when we want to check the carry flag and when we want to check particular bit in the specified
register. There are types of shift operations and rotate operations both with carry and with out
carry. For ex RCR means Rotate with carry.
4(a). PROGRAM (for Shift Operation:

Lingayas Institute of Management and Technology, Madalavarigudem, Vijayawada-521212. 11

5. RESULTS:
INPUT

OUTPUT

4(b). PROGRAM (for Rotate Operation:

Lingayas Institute of Management and Technology, Madalavarigudem, Vijayawada-521212. 12

5. RESULTS:
INPUT

OUTPUT

6. CONCLUSION:

7. VIVA -VOCE QUESTIONS:


1. What are the commands to perform this program on the kit?
2. Explain RCR instruction?
3. Explain ROR instruction?
4. Explain ROL instruction?
5. Explain SHL instruction?
6. Explain SHR instruction?
7. If the count is more than one, how we can write the shift or rotate instruction?
Lingayas Institute of Management and Technology, Madalavarigudem, Vijayawada-521212. 13

PACKED BCD TO UNPACKED BCD


BCD TO ASCII CONVERSION

EXPT. NO: 5
DATE:

1. AIM: Write an ALP in 8086 to convert from Packed BCD to Unpacked BCD.
2. COMPONENTS & TOOLS REQUIRED:
2.1 Personal Computer,
2.2 TASM Software
3. THEORY:
BCD means Binary Code Decimal. Binary Coded Decimal numbers are the numbers which
are decimal numbers from 0 to 9, but they are represented in binary form.
Generally we deal with decimal numbers rather than Hexa decimal numbers. So it is necessary to
know how to convert from Packed BCD to unpacked BCD. When we are converting we use
masking operations using AND instructions.
The packed BCD number can be converted to its ASCII equivalent using logical instructions.
The ASCII equivalents for the BCD numbers of 0, 1, 2, 9 are 30, 31, 32, 39 respectively. First
the packed BCD is converted to unpacked BCD and then converted to ASCII equivalent by using
the logical OR operation.
4(a). PROGRAM (for PACKED BCD TO UNPACKED BCD):

Lingayas Institute of Management and Technology, Madalavarigudem, Vijayawada-521212. 14

5. RESULTS:

INPUT

OUTPUT

4(b). PROGRAM (for PACKED BCD TO UNPACKED BCD):

Lingayas Institute of Management and Technology, Madalavarigudem, Vijayawada-521212. 15

5. RESULTS:
INPUT

OUTPUT

6. CONCLUSION:

7. VIVA -VOCE QUESTIONS:


1. What are the commands to perform this program on the kit?
2. What numbers the BCD numbers consists of?
3. Give an example for Packed BCD number?
4. Give an example for unpacked BCD number?
5. What is the difference between AND and TEST instruction?
6. What is the procedure to convert from Packed BCD to Unpacked BCD?
7. What is the difference between BCD and Hex number?

Lingayas Institute of Management and Technology, Madalavarigudem, Vijayawada-521212. 16

EXPT. NO: 6

STRING OPERATIONS

DATE:
1. AIM: Write an ALP in 8086 using string operations for following:
(a) Move Block of Data

(b) Length of the String

(e) Sorting

(f) String Comparison.

(c) Inserting

(d) Deleting

2. COMPONENTS & TOOLS REQUIRED:


2.1 Computer system,
2.2 MASM / TASM SOFTWARE
3(a). PROGRAM (Move Block of Data):

4(a) EXPECTED RESULTS:


Lingayas Institute of Management and Technology, Madalavarigudem, Vijayawada-521212. 17

3(b). PROGRAM (Length of the String):

4(b) EXPECTED RESULTS:

Lingayas Institute of Management and Technology, Madalavarigudem, Vijayawada-521212. 18

3(c). PROGRAM (Inserting):

4(c) EXPECTED RESULTS:

Lingayas Institute of Management and Technology, Madalavarigudem, Vijayawada-521212. 19

3(d). PROGRAM (Deleting):

4(d) EXPECTED RESULTS:

Lingayas Institute of Management and Technology, Madalavarigudem, Vijayawada-521212. 20

3(e). PROGRAM (Sorting):

4(e) EXPECTED RESULTS:

Lingayas Institute of Management and Technology, Madalavarigudem, Vijayawada-521212. 21

3(f). PROGRAM (String Comparison):

4(f) EXPECTED RESULTS:

Lingayas Institute of Management and Technology, Madalavarigudem, Vijayawada-521212. 22

5. CONCLUSION:

6. VIVA QUESTIONS:
1. What is the instruction to jump instruction in implementing the sorting of signed numbers
in ascending order?
2. What is the instruction to jump instruction in implementing the sorting of unsigned
numbers in ascending order?
3. Give names of different sorting methods?
4. What is the difference between XCHG and CMP?
5. What is the difference between CMP and TEST?

Lingayas Institute of Management and Technology, Madalavarigudem, Vijayawada-521212. 23

DOS/BIOS PROGRAMMING

EXPT. NO: 7
DATE:

1. AIM: Write an ALP in 8086 for DOS/BIOS programming to read a character from key board with
or without echo and display characters/strings.
2. COMPONENTS & TOOLS REQUIRED:
2.1 Computer system,
2.2 MASM / TASM SOFTWARE
3. THEORY: (READ A CHARACTER FROM KEYBOARD)
01h is the function code to read the key from keyboard with echo. This function code will be stored
in the AH register. The characters (ASCII characters) which we typed will be stored in the AL
register and also displays on the screen. If AL=00H, the function call must be invoked again to
read an extended ASCII character. This function call automatically Echo and whatever is typed on
the video screen.
08H is the function code to read the key from keyboard without echo. The 08H code will be stored
in the AH register. The character (ASCII characters) which we typed will be stored in the AL
register.
The standard input device can be assigned as either the keyboard or the com port. This function
respond to a control break. A control break causes INT23H to execute.
09H is the function code to display a character string. This 09H will be stored in AH register. The
starting address of the string which we type through keyboard will be stored in DS:DX register.
The character string must end with an ASCII $. The character string can be of any length and
may contains control character such as carriage return 0DH) and line feed (0AH).
Lingayas Institute of Management and Technology, Madalavarigudem, Vijayawada-521212. 24

4(a). PROGRAM (Display characters):

5. EXPECTED RESULTS:

Lingayas Institute of Management and Technology, Madalavarigudem, Vijayawada-521212. 25

4(b). PROGRAM (Reading Keyboard)

Lingayas Institute of Management and Technology, Madalavarigudem, Vijayawada-521212. 26

5. EXPECTED RESULTS:
i) With Echo:
INPUT:
OUTPUT:
ii) With out Echo:
INPUT:
OUTPUT:
6. CONCLUSION:

7. VIVA -VOCE QUESTIONS:


1.
2.
3.
4.
5.
6.
7.
8.
9.

What is meant by the function code 01H?


What is meant by the function code 0aH?
What is meant by the function code 08H?
What is meant by the function code 09H?
What the $ indicates at the end of string?
What is with echo?
What is without echo?
What are the commands to execute this program?
What is INT 21H?

Lingayas Institute of Management and Technology, Madalavarigudem, Vijayawada-521212. 27

EXPT. NO: 1

8255 PPI INTERFACING

DATE:
1. AIM: Write an ALP in 8086 to interface 8255 PPI, generate sinusoidal wave using DAC
interfacing.
2. COMPONENTS & TOOLS REQUIRED:
2.1 Microprocessor 8086 Trainer Kit,
2.2 Power supply (5V, 3A)
2.3 DAC interface module
2.4 Power supply (12V)
2.5 Flat ribbon cable
2.6 Connector (3 or 4 pin)
3. THEORY:
The Dual DAC interface can be used to generate different interesting waveforms using
microprocessor. There are two eight-bit digital to analog converters provided, based on DAC 0800.
The digital inputs to these DACs are provided through the port A and port B of 8255 used as output
ports. The analog output from the DACs are given to operational amplifiers which act as current to
voltage converters. Two 10 K ohms pots are provided for the offset balancing of opamps.
The reference voltage needed for the DACs is obtained from a onboard voltage regulator uA723.
The voltage generated by this regulator is about 8V The outputs from the DACs vary between 0 to
5V corresponding to values between 00 to FF. Different waveforms can be observed at the opamp
outputs depending upon the digital input patterns.
For One Clock = 1 / 8 MHz = 0.125 s
To generate 1 ms delay i.e. 1000s = 1000 / 0.125 = 8000 Clock Cycles (CT)

L1:

MOV CX, N

4 Cycles

NOP

3 Cycles

NOP

3 Cycles

LOOP L1

17 or 5 Cycles

( C0 )
CL

Lingayas Institute of Management and Technology, Madalavarigudem, Vijayawada-521212. 28

CT = C0 + N (CL) 12
N = CT C0 + 12 / CL
= (8000 4 + 12) / 23
= 349 = 015D
CX = 015D
4. PROGRAM:

Lingayas Institute of Management and Technology, Madalavarigudem, Vijayawada-521212. 29

Amplitude =
Time period =
Frequency =

5. CONCLUSION:

6. PRECAUTIONS:
1. Give connections carefully such as Keyboard, Flat Ribbon cable if any and power supply
etc.
2. Switch on the power supply only after giving all the connections.
3. Handle the Trainer kits carefully.
7. VIVA-VOCE QUESTIONS:
1. Explain OUT and IN instructions?
2. What is the difference between Fixed Port and Variable Port?
3. What are the commands to execute this program?
4. What is Duty Cycle?
5. How can you generate Ramp Waveform?
6. How can you write 2ms delay program?
7. What is the difference between Macro and Procedure?
8. What is the difference between conditional Jump and Unconditional Jump instructions?

Lingayas Institute of Management and Technology, Madalavarigudem, Vijayawada-521212. 30

8279 KEY BOARD DISPLAY

EXPT. NO: 2
DATE:

1. AIM: Write an ALP in 8086 to interface 8279 key board display and display a string of characters.
2. COMPONENTS & TOOLS REQUIRED:
2.1 Microprocessor 8086 Trainer Kit,
2.2 Power supply (5V, 3A)
2.3 8279 key board display interfacing module
2.4 Flat ribbon cable
3. THEORY:
ROLLING DISPLAY
Display/Keyboard mode set word and clear word take care of basic initialization of 8279. However,
before sending codes to the display RAM, a write display RAM control word should be sent. Then,
write the data to be displayed, to the data register.
Then, the data is fetched from address and is displayed in the first digit of the display. The next
data is displayed in the second digit of the display, since in the command word for write display
RAM the Auto increment flag is set. A time delay is given between successive digits for a lively
display.
N KEY ROLLOVER
With N-key rollover each key depression is treated independently from all others. When a key is
depressed, the debounce circuit waits 2 keyboard scans and then checks to see if the key is still
down. If it is, the key is entered into the FIFO. Any number of keys can be depressed and another
can be recognized and entered according to the order the keyboard scan found them

Lingayas Institute of Management and Technology, Madalavarigudem, Vijayawada-521212. 31

Any number of keys can b depressed and all will be entered There is no constraint that all keys
should be released before a depressed key is to be recognized.

ROLLING DISPLAY ( " ECE IS GOOD ")


a
f

b
g

c
. dp
d

SEGMENT
LETTER 'E'
HEX CODE

d
0

c
1

b
1
6

A
0

dp
1

g
0

f
0

e
0

4. PROGRAM:
ROLLING DISPLAY

Lingayas Institute of Management and Technology, Madalavarigudem, Vijayawada-521212. 32

5. EXPECTED RESULTS:

6. CONCLUSION:

Lingayas Institute of Management and Technology, Madalavarigudem, Vijayawada-521212. 33

7. PRECAUTIONS:
1. Give connections carefully such as Keyboard, Flat Ribbon cable if any and power supply
etc.
2. Switch on the power supply only after giving all the connections.
3. Handle the Trainer kits carefully.
8. VIVA-VOCE QUESTIONS:
1. What is Two-key lock out?
2. What is N-Key Roll over?
3. What are the MASM commands to execute this program?
4. What is the chip number for the BCD to 7 segment display?
5. What is look-up table? And Give an example?
6. What is the chip number of keyboard-display interface?

Lingayas Institute of Management and Technology, Madalavarigudem, Vijayawada-521212. 34

8259 INTERRUPT CONTROLLER

EXPT. NO: 3
DATE:

1. AIM: Write an ALP in 8086 to interface 8259 Interrupt Controller.


2. COMPONENTS & TOOLS REQUIRED:
2.1 Microprocessor 8086 Trainer Kit,
2.2 Power supply (5V, 3A)
3. THEORY:
8086 INTERRUPT RESPONSE:
1. Send out two interrupt acknowledge pulses on its INTA pin to the INTA pin of an 8259. The
INTA pulses tell the 8259 to send the desired interrupt type to the 8086 on the data bus.
2. Multiply the interrupt type it receives from the 8259 by 4 to produce an address in the
interrupt vector table.
3. Push the flags on the stack.
4. Clear IF and TF
5. Push the return address on the stack.
6. Get the starting address for the interrupt procedure from the interrupt-vector table and load
that address in CS and IP
7. Execute the interrupt-service procedure.
8259 INTERRUPT CONTROLLER
To initialize the 8259 with the following specification:
ICW 4 needed (ICW = Initialization Command Word)
Single 8259
Interval of 4
Edge triggered mode
A7
A6
A5
=
000
Initialize to type 8 interrupt
8086 mode
Normal EOI (EOI = End Of Interrupt)
Non-buffered mode (Since we are not using buffers)
Lingayas Institute of Management and Technology, Madalavarigudem, Vijayawada-521212. 35

Not special fully-nested mode


Mask all interrupts except IRQ 0

4. PROGRAM:

Lingayas Institute of Management and Technology, Madalavarigudem, Vijayawada-521212. 36

Lingayas Institute of Management and Technology, Madalavarigudem, Vijayawada-521212. 37

PROGRAM DESCRIPTION:
The main program initializes the 8259 to the above specifications. The program initializes the 8259
to type 8. So the interrupt vector for interrupt IR0 is 0000:0020. So at 0000:0020, enter the address
0000: 1200H, the ISR is at 0000:1200.
In the ISR, non-specific EOI command is given. In fully nested mode, the interrupt requests are
ordered in priority from 0 through 7 (0 highest). But in some applications there are a number of
interrupting devices of equal priority. In this mode, a device after being serviced receives the lowest
priority. This is known as Rotating Priority.
5. EXPECTED RESULTS:

6. CONCLUSION:

7. PRECAUTIONS:
1. Give connections carefully such as Keyboard, Flat Ribbon cable if any and power supply
etc.
2. Switch on the power supply only after giving all the connections.
3. Handle the Trainer kits carefully.
8. VIVA-VOCE QUESTIONS:
1. What is 8086 interrupt response?
2. What is the flag that has to be set when we want to use INTR pin?
3. What is the purpose of IE flag?
4. How many interrupts are there in 8086?
5. What is the difference between the software interrupt and hard ware interrupt?
6. What is the highest priority interrupt in 8086?
7. What is the use of ICW?
8. What is the use of OCW?
Lingayas Institute of Management and Technology, Madalavarigudem, Vijayawada-521212. 38

9. Explain the format of ICW1?


10. Explain the format of ICW2?

WRITING TO PARALLEL PORT

EXPT. NO: 1
DATE:

1. AIM: Write 8051 program to implement writing to parallel port.


2. COMPONENTS & TOOLS REQUIRED:
2.1 Microcontroller 8031/51 Trainer Kit,
2.2 Power supply (5V, 3A)
3. THEORY:
Though there are 32 I/O lines available in 8051, only 8 I/O lines (Port 1) are exclusively
available for the user. This is because; the output drivers of Ports 0 and 2 and input buffers of
port 0 are used in accesses to external memory. Also, all the Port 3 pins are multifunctional.
To write any data to Port 1, Port 1 register (P1) should be loaded with that data to be output. As
all the 8 I/O lines are bit addressable, they can be programmed either low or high
independently.
8051 has four parallel ports. But, only Port 1 is user-free as Port 2 outputs the high byte of the
external memory address and Port 0 outputs the low byte of the external memory address,
time-multiplexed with the byte being written or read and port 3 pins have alternate functions.
4. PROGRAM:

Lingayas Institute of Management and Technology, Madalavarigudem, Vijayawada-521212. 39

5. EXPECTED RESULTS:

6. CONCLUSION:

7. PRECAUTIONS:
1. Give connections carefully such as Keyboard, Flat Ribbon cable if any and power supply
etc.
2. Switch on the power supply only after giving all the connections.
3. Handle the Trainer kits carefully.
8. VIVA-VOCE QUESTIONS:
1. How many ports are there in 8051 microcontroller?
2. What is the alternate function of Port 0?
3. What is the alternate function of Port 1?
4. Name the port which does not having alternate function?
5. What is the alternate function of Port 4?
6. How many address lines are there in 8051?
7. What is the length of Data Bus in 8051?

Lingayas Institute of Management and Technology, Madalavarigudem, Vijayawada-521212. 40

You might also like