Experiment 1
LAB REPORT
Objective:
In this experiment , we learn how to use the software 8085 simulator IDE to write firmware for 8085 microprocessor . we use some basic instructions for example: mvi, add , jmp , lxi , stax , hlt , to write the firmware .
Problem:
1) Write a program for X+Y=Z where X,Y,Z are variable stored in memory
2) Explain the program in detail.
3) Describe the effect in the flag register for the instructions used
Solution:
1) & 2)
lxi h,9000h ;value of register pair HL which is a memory address
mov a,m ;load value in A from the memory location addressed by HL
lxi h,9001h ;value of register pair HL which is a memory address
mov b,m ;load value in B from the memory location addressed by HL
add b ;A=A+B
sta 9002h ;store value of a in the memory location 9002h
hlt
3)
No. PC Instruction A SZ_A_P_C B C D E H L SP
1 0000 LXI H,9000H FF 11111111 FF FF FF FF 90 00 FFFF
2 0003 MOV A,M AE 11111111 FF FF FF FF 90 00 FFFF
3 0004 LXI H,9001H AE 11111111 FF FF FF FF 90 01 FFFF
4 0007 MOV B,M AE 11111111 FF FF FF FF 90 01 FFFF
5 0008 ADD B AD 10111011 FF FF FF FF 90 01 FFFF
6 0009 STA 9002H AD 10111011 FF FF FF FF 90 01 FFFF
7 000C HLT AD 10111011 FF FF FF FF 90 01 FFFF
162.0 seconds elapsed.
Real-time duration of the simulation is 56 clock cycles or 14.00 µs at 4 MHz.
Discussion:
In the given problem , we load two variables in two registers from the memory and add those variables and finally store the result in memory .
LAB REPORT_2
Experiment Name: 8085 code conversion, sub-routine and stack pointer
Objective: Learn about sub-routine, the purpose of stack pointer & the use of delay sub-routine is the main
objective of experiment 2.
Problem: Write a delay sub-routine for 100ms unit .
Solution;
delay: lxi sp,0ffffh ;initialized stack pointer
mvi c,88 ; load 88 in register c
l1 call delay1 ;call sub-routine delay1
dcr c ;decrease the value of register c
jnz l1 ;jump to level1 if zero flag is not high
hlt ;end
delay1: ;sub-routine delay1
mvi a,255 ;load 255 in register a
l2 mov b,a ;move the value of a in b
dcr a ;decrease the value of a
jnz l2 ;jump to level2 if zero flag is not high
ret ;return to the main delay sub-routine
LOG FILE:
Simulation started at 7/4/2009 12:53:41 AM.
No. PC Instruction A SZ_A_P_C B C D E H L SP
1 0000 LXI SP,0FFFFH FF 11111111 FF FF FF FF FF FF FFFF
2 0003 MVI C,58H FF 11111111 FF 58 FF FF FF FF FFFF
3 0005 CALL 000DH FF 11111111 FF 58 FF FF FF FF FFFD
4 000D MVI A,0FFH FF 11111111 FF 58 FF FF FF FF FFFD
5 000F MOV B,A FF 11111111 FF 58 FF FF FF FF FFFD
6 0010 DCR A FE 10101011 FF 58 FF FF FF FF FFFD
7 0011 JNZ 000FH FE 10101011 FF 58 FF FF FF FF FFFD
8 000F MOV B,A FE 10101011 FE 58 FF FF FF FF FFFD
9 0010 DCR A FD 10101011 FE 58 FF FF FF FF FFFD
.
.
7754 000F MOV B,A 02 00101011 02 01 FF FF FF FF FFFD
67755 0010 DCR A 01 00101011 02 01 FF FF FF FF FFFD
67756 0011 JNZ 000FH 01 00101011 02 01 FF FF FF FF FFFD
67757 000F MOV B,A 01 00101011 01 01 FF FF FF FF FFFD
67758 0010 DCR A 00 01101111 01 01 FF FF FF FF FFFD
67759 0011 JNZ 000FH 00 01101111 01 01 FF FF FF FF FFFD
67760 0014 RET 00 01101111 01 01 FF FF FF FF FFFF
67761 0008 DCR C 00 01101111 01 00 FF FF FF FF FFFF
67762 0009 JNZ 0005H 00 01101111 01 00 FF FF FF FF FFFF
67763 000C HLT 00 01101111 01 00 FF FF FF FF FFFF
Simulation stopped at 7/4/2009 12:53:57 AM.
16.21 seconds elapsed.
Real-time duration of the simulation is 407987 clock cycles or 101996.75 µs at 4 MHz.
The purpose of stack pointer:
If we use ‘call’ instruction in our program than we must use stack pointer also. Stack pointer is an address where
the return address is written . Program counter get the return address from the stack pointer where it should
return from the sub- routine.
Discussion: we mainly learn about the purpose of sub-routine & stack pointer in a program. We observe stack
pointer is mandatory if we use ‘call’ instruction in the program.
Experiment #3
Problem: Write a program to show first alphabet of your name in the dot matrix which is connect to the port of 89C51 microcontroller.
Program:
ljmp 30h ; long jump to 30h
org 30h
mov 30h,#62h ;load 62h in address 30h
mov 31h,#82h
mov 32h,#82h
mov 33h,#7fh
mov 34h,#02h
mov 35h,#02h
ljmp 200h
org 200h
main : mov r2,#6 ;load 6 in register2
mov b,#02h
mov r0,#0
level2: mov a,#30h
add a,r0 ; add value of acc & register0
mov r1,a
mov a,@r1 ; move value from address written in r1
mov p0,a ; send the value of acc in port 0
call select ; call select sub
call delay ; call delay sub
inc r0 ;increase the value of register 0
djnz r2 ,level2 ; decrease value of r2 & jump to level2 if not zero
call delay
sjmp main ;short jump to level1
; select sub to select the column of dot matrix
select: mov p1,b ;send the value of b in port 1
mov a,b
rl a ; rotate left the value of accumulator
mov b,a
ret ; return to the main function
;delay sub for 4ms/400us delay
delay: mov r4,#2
l1: mov r3,#133
l2: djnz r3,l2
djnz r4,l1
ret
end ; end of the program
1 comment:
we post thz lab report as a sample. if u write what u actually need it wil b easier 4 us to help u.
u can ask for any kind of help related to ur study. we try 2 help u
thanks
Xuiuen
Post a Comment