Upload
mohan-gupta
View
221
Download
0
Embed Size (px)
Citation preview
8/2/2019 pgm 9
1/6
PROGRAM09
AimTo find the addition of 16-bit number in variable of size array by using 8085 microprocessor.
Apparatus Required8085 kit, connecting wires.
Algorithm1) Start the program by loading the first data into Accumulator. 2) Move the data to a register (B register).3) Get the second data and load into Accumulator. 4) Add the two register content.5) Store the value of sum in memory location.6) Terminate the program.
8/2/2019 pgm 9
2/6
8/2/2019 pgm 9
3/6
Program
ADDEESS MNEMONICS OPERAND(S) OPCODE REMARKS
2000 LHLD 2500 2A [L] [25]
2001 00 [H] [00+1]
2002 25
2003 XCHG EB [H-L] [D-E]
2004 LHLD 2502 2A [L] [25]
2005 02 [H] [02+1]
2006 252007 MOV A,E 7B [A] [E]
2008 ADD H 85 [A] [A] +[H]
2009 MOV L,A 6F [L] [A]
200A MOV A,D 7A [A] [D]
200B ADC H 8C [A] [A]+ [H]
200C MOV H,A 67 [H] [A]
200D SHLD 2504 22 [25] [H]
200E 04 [04+1] [L]
200F 25
2010 HLT EF HALT
8/2/2019 pgm 9
4/6
Procedure
1) Enter Programa) Press RESET.b) Now press EXTERNAL MEMORY (EXMEM).c) Enter starting address of the program (i.e., 2000) as per given in address column in above
table.
d) Press NEXT.e) Start entering the opcodes.f) Press NEXT to store.
2) Enter Dataa) Press RESET to reach desired memory location.b) Press EXTERNAL MEMORY (EXMEM).c) Enter the address of the operand.d) Press NEXT to store the address.
3) Execute programa)
Press RESET.
b) Press GO.c) Enter starting address of the program (i.e., 2500).d) Press FILL.
4) Check resulta) Press RESET.b) Press EXTERNAL MEMORY (EXMEM).c) Enter address of result (i.e., 2504).d) Press NEXT to get output.
8/2/2019 pgm 9
5/6
LXI H, 2500 H Load H-L pair by 2500H
MOVA, M Move the content of the memory location 2500H to register A.
INX H The content of the register pair H is incremented by one. No
flag is affected.
SUB M The content of the memory location addressed by H-L pair issubtracted from the content of the accumulator. The result is
placed in the accumulator.
STA, 2040H The content of the accumulator is stored in memory location is
specified by the 2nd and 3rd byte of the instruction. STA
2050H will store the store the content of the accumulator in
the memory location 2050H.
HLT Halt.
Observation
InputADDEESS DATA
2500 03
2601 02
2602 01
2603 03
Result
OutputMEMORY DATA (Sum)
2604 00
2605 06
Thus the program to find the largest number in an array of data was ex
8/2/2019 pgm 9
6/6