0% found this document useful (0 votes)
15 views

Aec EEC533 Microprocessor Manual

The document describes two experiments involving arithmetic operations using an 8085 microprocessor. Experiment 1 involves adding and subtracting hexadecimal and decimal numbers by loading the numbers into registers, performing operations, and storing the results. Flow charts are provided. Experiment 2 converts a hexadecimal number to its ASCII equivalent and vice versa. It also describes adding and subtracting binary-coded decimal numbers by loading the numbers, performing operations with adjustment, and storing the results.

Uploaded by

virendra.arya
Copyright
© © All Rights Reserved
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views

Aec EEC533 Microprocessor Manual

The document describes two experiments involving arithmetic operations using an 8085 microprocessor. Experiment 1 involves adding and subtracting hexadecimal and decimal numbers by loading the numbers into registers, performing operations, and storing the results. Flow charts are provided. Experiment 2 converts a hexadecimal number to its ASCII equivalent and vice versa. It also describes adding and subtracting binary-coded decimal numbers by loading the numbers, performing operations with adjustment, and storing the results.

Uploaded by

virendra.arya
Copyright
© © All Rights Reserved
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 21

EXPERIMENT 1

OBJECT: To perform Decimal, Hexadecimal addition and subtraction of two numbers.

EQUIPMENT USED: 8085 microprocessor training kit, Power supply, keyboard

PROGRAM:

HEXADECIMAL ADDITION AND SUBTRACTION

Addition:
2000 LXI H,2501 Load the address of first number in H-L pair.
2003 MOV A,M Get first number in accumulator.
2004 INX H Get address of second number in H-L pair.
2005 ADD M Add two numbers.
2006 STA 2503H Store result at specified memory location.
2009 RST 5 To set Breakpoint

Subtraction:
2000 LXI H,2501 Load the address of first number in H-L pair.
2003 MOV A,M Get first number in accumulator.
2004 INX H Get address of second number in H-L pair.
2005 SUB M Subtract two numbers.
2006 STA 2503H Store result at specified memory location.
2009 RST 5 To set Breakpoint

DECIMAL ADDITION AND SUBTRACTION

Addition:
2000 LXI H,2501 Load the address of first number in H-L pair.
2003 MOV A,M Get first number in accumulator.
2004 INX H Get address of second number in H-L pair.
2005 ADD M Add two numbers.
2006 DAA Convert to decimal
2007 STA 2503H Store result at specified memory location.
200A RST 5 To set Breakpoint

Subtraction:
2000 LXI H,2501 Load the address of first number in H-L pair.
2003 MOV A,M Get first number in accumulator.
2004 INX H Get address of second number in H-L pair.
2005 SUB M Subtract two numbers.
2006 DAA Convert to decimal
2007 STA 2503H Store result at specified memory location.
200A RST 5 To set Breakpoint

RESULT: The program is executed and the result is verified.


PRECAUTION: Before executing the program make sure that it is entered properly.

Flow chart for Addition of two hex numbers

Flow chart for Subtraction of two hex numbers

Subtract two numbers


Flow chart for Addition of two Decimal numbers

Start

Load address of 1st number in H – L pair

Get 1st number in Accumulator

Get address of 2nd number in H – L


pair

Add two numbers

Convert Accumulator HEX number


into Decimal number

Store the Result

Stop

Flow chart for Subtraction of two Decimal numbers

Start

Load address of 1st number in H – L pair

Get 1st number in Accumulator

Get address of 2nd number in H – L


pair

Subtract two numbers

Convert Accumulator HEX number


into Decimal number

Store the Result


Stop

EXPERIMENT 2

OBJECT: To perform addition and subtraction of two BCD numbers using 8085 microprocessor.

EQUIPMENT USED: 8085 microprocessor training kit, Power supply, keyboard

PROGRAM:

2000 LXI H,2501H Load the address of first number in H-L pair.
2003 MOV C,M Get first number in Register C.
2004 SUB A
2005 MOV B,A
2006 INX H
2007 ADD M
2008 DAA
2009 JNC NOF
200C PUSH PSW
200 MOV A,B
200 ADI 01H
200 DAA
MOV B,A
POP PSW
NOF: DCR C
JNZ 2006
MOV L,A
MOV H,B
OBJECT: To convert given Hexadecimal number into its equivalent ASCII number and vice versa
using 8085 instruction set.

EQUIPMENT USED: 8085 microprocessor training kit, Power supply, keyboard

PROGRAM:

HEX TO ASCII CONVERSION

ALGORITHM:

1. Load the given data in A- register and move to B – register


2. Mask the upper nibble of the Hexa decimal number in A – register
3. Call subroutine to get ASCII of lower nibble
4. Store it in memory
5. Move B –register to A – register and mask the lower nibble
6. Rotate the upper nibble to lower nibble position
7. Call subroutine to get ASCII of upper nibble
8. Store it in memory
9. Terminate the program.

PROGRAM:

LDA 4200 Get Hexa Data


MOV B,A
ANI 0F Mask Upper Nibble
CALL SUB1 Get ASCII code for upper nibble
STA 4201
MOV A,B
ANI F0 Mask Lower Nibble
RLC
RLC
RLC
RLC
CALL SUB1 Get ASCII code for lower nibble
STA 4202
HLT

SUB1: CPI 0A
JC SKIP
ADI 07
SKIP: ADI 30
RET
OBSERVATION:

Input: 4200 E4(Hexa data)

Output: 4201 34(ASCII Code for 4)


4202 45(ASCII Code for E)

RESULT:

Thus the given Hex decimal number was converted into its equivalent ASCII Code.

ASCII TO HEX CONVERSION

ALGORITHM:

1. Load the given data in A- register


2. Subtract 30 H from A – register
3. Compare the content of A – register with 0A H
4. If A < 0A H, jump to step6. Else proceed to next step.
5. Subtract 07 H from A – register
6. Store the result
7. Terminate the program

PROGRAM:

LDA 4500
SUI 30
CPI 0A
JC SKIP
SUI 07
SKIP: STA 4501
HLT

OBSERVATION:

Input: 4500 31

Output: 4501 0B

RESULT:

Thus the given ASCII character was converted into its equivalent Hex Value.
EXPERIMENT 2
OBJECT: Write a program using 8085 Microprocessor for addition and subtraction of two BCD
numbers.

EQUIPMENT USED: 8085 microprocessor training kit, Power supply, keyboard

BCD ADDITION
ALGORITHM:
1. Initialize memory pointer to data location.
2. Get the first number from memory in accumulator.
3. Get the second number and add it to the accumulator
4. Adjust the accumulator value to the proper BCD value using DAA instruction.
5. Store the answer at another memory location.

PROGRAM: BCD ADDITION

ADDRESS OPCODE MNEMONICS OPERAND COMMENT


2000 MVI C, 00 Clear C reg.
2002 LXI H, 3500 Initialize HL reg. to 3500
2005 MOV A, M Transfer first data to accumulator
2006 INX H Increment HL reg. to point next memory
Location.
2007 ADD M Add first number to acc. Content.
2008 DAA Decimal adjust accumulator
2009 JNC 200D Jump to location if result does not yield
carry.
200C INR C Increment C reg.
200D INX H Increment HL reg. to point next memory
Location.
200E MOV M, A Transfer the result from acc. to memory.
200F INX H Increment HL reg. to point next memory
Location.
2010 MOV M, C Move carry to memory
2011 RST 5 Stop the program

OBSERVATION:

INPUT OUTPUT
3500 3502
3501 3503

RESULT:

Thus the 8 bit BCD numbers stored at 3500 & 3501 are added and the result stored at 3502 & 3503.
BCD SUBTRACTION
ALGORITHM:

1. Load the minuend and subtrahend in two registers.


2. Initialize Borrow register to 0.
3. Take the 100’s complement of the subtrahend.
4. Add the result with the minuend which yields the result.
5. Adjust the accumulator value to the proper BCD value using DAA instruction. If there is a
carry ignore it.
6. If there is no carry, increment the carry register by 1
7. Store the content of the accumulator (result) and borrow register in the specified memory
location

PROGRAM: BCD SUBTRACTION

ADDRESS OPCODE MNEMONICS OPERAND COMMENT


2000 MVI D, 00 Clear D reg.
2002 LXI H, 4500 Initialize HL reg. to 3500
2005 MOV B, M Transfer first data to accumulator
2006 INX H Increment HL reg. to point next mem. Location.
2007 MOV C, M Move second no. to B reg.
2008 MVI A, 99 Move 99 to the Accumulator
200A SUB C Subtract [C] from acc. Content.
200B INR A Increment A register
200C ADD B Add [B] with [A]
200D DAA Adjust Accumulator value for Decimal digits
200E JC 2012 Jump on carry to 2012
2011 INR D Increment D reg.
2012 INX H Increment HL register pair
2013 MOV M,A Move the Acc. content to the memory location
2014 INX H Increment HL reg. to point next mem. Location.
2015 MOV M, D Transfer D register content to memory.
2016 RST 5 Stop the program

OBSERVATION:

INPUT OUTPUT
3500 3502
3501 3503

RESULT:

Thus the 8 bit BCD numbers stored at 3500 & 3501 are subtracted and the result stored at 3502 & 3503.
FLOW CHART FOR BCD ADDTION:

START

[C] 00H

[HL] 3500H

[A] [M]

[HL][HL]+1

[A][A]+[M]
Decimal Adjust Accumulator

Is there a
Carry?

[C][C]+1

[HL][HL]+1

[M] [A]

[HL][HL]+1

[M] [C]

STOP
FLOW CHART FOR BCD SUBTRACTION:

START

[D] 00H
HL 3500
B M

HL HL+ 1
C M
A 99

[A] [A] – [C]


[A] [A] +1

[A][A]+[B]
DAA

Is there a
Carry?

[D][D]+1

[HL][HL]+1

[3502] A
[3503] D

STOP
EXPERIMENT 3

OBJECT: To perform Multiplication and Division of two 8 bit numbers using 8085

EQUIPMENT USED: 8085 microprocessor training kit, Power supply, keyboard

PROGRAM: Multiplication of 8-bit numbers

2000 LDA 2200H


2003 MOV E, A
2004 MVI D, 00 : Get the first number in DE register pair
2006 LDA 2201H
2009 MOV C, A : Initialize counter
200A LX I H, 0000 H : Result = 0
200D DAD D : Result = result + first number
200E DCR C : Decrement count
200F JNZ 200D : If count 0 repeat
2012 SHLD 2300H : Store result
2015 RST 5 : Terminate program execution

PROGRAM: Division of 8-bit numbers

2000 LHLD 3501


2003 LDA 3503
2006 MOV B, A
2007 MVI C, 08
2009 DAD H
200A MOV A, H
200B SUB B
200C JC 2011
200F MOV H, A
2010 INR L
2011 DCR C
2012 JNZ 2009
2015 SHLD 3504
2018 RST 5

RESULT: The program is executed and the result is verified.

PRECAUTION: Before executing the program make sure that it is entered properly.
Flow chart for multiplication 8- bit numbers
Flow chart for division of two 8-bit numbers
Division program

Stepwise procedure:
Program for binary division (successive subtraction method)
1 Program statement:
Dividend is stored a t memory location 20C2 H. The Divisor is stored a t memory location
20C3 H. Store the Quotient at 20C0 H and Remainder at memory location 20C1 H.
2 Algorithm:
1. Initialize the C register with 00H as a counter for Quotient.
2. Get dividend in Accumulator from memory.
3. Get the address of divisor.
4. Subtract the divisor from dividend.
5. If dividend is greater than divisor, Increment register C
6. Store remainder in register B for result, and repeat step 4.
7. Otherwise store the contents of accumulator as Remainder in memory location.
8. Store the content of C register as Quotient in memory.

3 Assembly Language Program:

4. Result:

EXPERIMENT 6
OBJECT: To convert given Hexa decimal number into its equivalent ASCII number and vice versa using
8085 instruction set.

EQUIPMENT USED: 8085 microprocessor training kit, Power supply, keyboard

PROGRAM: Hex to Ascii Conversion


ALGORITHM:
1. Load the given data in A- register and move to B – register
2. Mask the upper nibble of the Hexa decimal number in A – register
3. Call subroutine to get ASCII of lower nibble
4. Store it in memory
5. Move B –register to A – register and mask the lower nibble
6. Rotate the upper nibble to lower nibble position
7. Call subroutine to get ASCII of upper nibble
8. Store it in memory
9. Terminate the program.

PROGRAM:

LDA 3500 Get Hexa Data


MOV B,A
ANI 0F Mask Upper Nibble
CALL SUB1 Get ASCII code for upper nibble
STA 3501
MOV A,B
ANI F0 Mask Lower Nibble
RLC
RLC
RLC
RLC
CALL SUB1 Get ASCII code for lower nibble
STA 3502
HLT

SUB1: CPI 0A
JC SKIP
ADI 07
SKIP: ADI 30
RET

OBSERVATION:

Input: 3500 E4(Hexa data)

RESULT: Output: 3501 34(ASCII Code for 4) Thus the given Hexa decimal number
was converted into its 3502 45(ASCII Code for E) equivalent ASCII Code.

ASCII TO HEX CONVERSION

ALGORITHM:

1. Load the given data in A- register


2. Subtract 30 H from A – register
3. Compare the content of A – register with 0A H
4. If A < 0A H, jump to step6. Else proceed to next step.
5. Subtract 07 H from A – register
6. Store the result
7. Terminate the program

PROGRAM:

LDA 3000
SUI 30
CPI 0A
JC SKIP
SUI 07
SKIP: STA 3001
HLT

OBSERVATION:

Input: 3000 31

Output: 3001 0B

RESULT:

Thus the given ASCII character was converted into its equivalent Hexa Value.

EXPERIMENT 9
OBJECT: To interface DAC with 8085 to demonstrate the generation of square, saw tooth and
triangular wave.
EQUIPMENT USED: 8085 microprocessor training kit, keyboard, DAC Interface Board, CRO
THEORY:
DAC 0800 is an 8 – bit DAC and the output voltage variation is between – 5V and +
5V.The output voltage varies in steps of 10/256 = 0.04 (appx.). The digital data input and
the corresponding output voltages are presented in the Table1.

Input Output
Data in Voltage
HEX
00 - 5.00
01 - 4.96
02 - 4.92
… …
7F 0.00
… …
FD 4.92
FE 4.96
FF 5.00

Referring to Table1, with 00 H as input to DAC, the analog output is – 5V. Similarly, with FF H as input, the
output is +5V. Outputting digital data 00 and FF at regular intervals, to DAC, results in different wave forms
namely square, triangular, etc,. The port address of DAC is 08 H.

ALGORITHM:
(a) Square Wave Generation

1. Load the initial value (00) to Accumulator and move it to DAC


2. Call the delay program
3. Load the final value (FF) to accumulator and move it to DAC
4. Call the delay program.
5. Repeat Steps 2 to 5

(b) Saw tooth Wave Generation

1. Load the initial value (00) to Accumulator


2. Move the accumulator content to DAC
3. Increment the accumulator content by 1.
4. Repeat Steps 3 and 4.

(c) Triangular Wave Generation


1. Load the initial value (00) to Accumulator
2. Move the accumulator content to DAC
3. Increment the accumulator content by 1.
4. If accumulator content is zero proceed to next step. Else go to step 3.
5. Load value (FF) to Accumulator
6. Move the accumulator content to DAC
7. Decrement the accumulator content by 1.
8. If accumulator content is zero go to step2. Else go to step 7.

PROGRAM:
(a) Square Wave Generation

START: MVI A,00


OUT Port address of DAC
CALL DELAY
MVI A,FF
OUT Port address of DAC
CALL DELAY
JMP START

DELAY: MVI B,05


L1: MVI C,FF
L2: DCR C
JNZ L2
DCR B
JNZ L1
RET

(b) Saw tooth Wave Generation

START: MVI A,00


L1: OUT Port address of DAC
INR A
JNZ L1
JMP START
(c) Triangular Wave Generation

START: MVI L,00


L1: MOV A,L
OUT Port address of DAC
INR L
JNZ L1
MVI L,FF
L2: MOV A,L
OUT Port address of DAC
DCR L
JNZ L2
JMP START

RESULT: Thus the square, triangular and saw tooth wave form were generated by interfacing
DAC with 8085 trainer kit.

EXPERIMENT 8
OBJECT: To interface 8253 programmable interval timer to 8085 and verify the operation of 8253 in
six different modes.
EQUIPMENT USED:

1) 8085 Microprocessor toolkit.


2) 8253 Interface board.
3) VXT parallel bus.
4) Regulated D.C power supply.
5) CRO.

MODE 0-Interrupt on Terminal Count:-

The output will be initially low after mode set operation. After loading the counter, the
output will remain low while counting and on terminal count, the output will become high
until reloaded again.

Let us see the channel in mode0. Connect the CLK 0 to the debounce circuit and
execute the following program.

PROGRAM:

MVI A, 30H ;Channel 0 in mode 0. OUT


CEH
MVI A, 05H ;LSB of count. OUT
C8H
MVI A, 00H ;MSB of count.
OUT C8H
RST 5

It is observed in CRO that the output of channel 0 is initially low. After giving ‘x’ clock
pulses, we may notice that the output goes high.

MODE 1-Programmable One Shot:-

After loading the count, the output will remain low following the rising edge of the
gate input. The output will go high on the terminal count. It is retriggerable; hence the
output will remain low for the full count after any rising edge of the gate input.
The following program initializes channel 0 of 8253 in Mode 1 and also initializes triggering
of gate. OUT 0 goes low as clock pulses and after triggering it goes back to high level after
five clock pulses. Execute the program and give clock pulses through the debounce logic and
verify using CRO.

PROGRAM:
MVI A, 32H ;Channel 0 in mode 1. OUT
CEH ;
MVI A, 05H ;LSB of count. OUT
C8H
MVI A, 00H ;MSB of count. OUT
C8H
OUT DOH ;Trigger Gate 0. RST 5

MODE 2-Rate Generator:

It is a simple divide by N counter. The output will be low for one period of the input
clock. The period from one output pulse to next equals the number of input count in the
count register. If the count register is reloaded between output pulses, the present period will
not be affected, but the subsequent period will reflect a new value.

MODE 3-Square Generator:

It is similar to mode 2 except that the output will remain high until one half of the
count and goes low for the other half provided the count is an even number. If the count is
odd the output will be high for (count +1)/2 counts. This mode is used for generating baud
rate of 8251.

PROGRAM:

MVI A, 36H ;Channel 0 in mode 3.


OUT CEH ;
MVI A, 0AH ;LSB of count.
OUT C8H
MVI A, 00H ;MSB of count.
OUT C8H
HLT

We utilize mode 3 to generate a square wave of frequency 150 kHz at Channel 0.Set the jumper so that
the clock of 8253 is given a square wave of Frequency 1.5 MHz. This program divides the program
clock by 10 and thus the Output at channel 0 is 150 KHz.

MODE 4-Software Triggered Strobe:

The output is high after the mode is set and also during counting. On Terminal
count, the output will go low for one clock period and becomes high again. This mode can
be used for interrupt generation.

MODE 5-Hardware Triggered Strobe:

Counter starts counting after rising edge of trigger input and the output goes low for
one clock period. When the terminal count is reached, the counter is retrigerrable. On
terminal count, the output will go low for one clock period and becomes high again. This
mode can be used for interrupt generation.

RESULT:
Thus the 8253 PIT was interfaced to 8085 and the operations for mode 0, Mode 1 and mode 3 was
verified

You might also like