8085 program for running light with delays using lookup table.


Here we will see how we can implement running light with some delays using 8085.

Problem Statement

Write 8085 program to implement running light display with appropriate delays using lookup table stored from memory location 8100H on words.

Discussion

The patterns are stored at location 8100 onwards. We are using 8255 port IC to display the content in LED displays. After displaying, it calls the delay to wait for some time and call the next byte from memory to display. So the display pattern will be like below -

 

Program

Address
HEX Codes
Labels
Mnemonics
Comments
8000
31, 00, 82
START:
LXI SP, 8200 H
Initializing the SP
8003
0E, 15
 
MVI C, 14 H
Initializing the counter
8005
21, 00, 81
 
LXI H, 8100 H
Pointing to the pattern IN-BUFFER
8008
3E, 99
 
MVI A, CW
Load the CW in the accumulator
800A 
D3, 43
 
OUT 43 H
Output the CW to control register
800C 
7E
AGAIN:
MOV A, M
Read pattern byte
800D 
D3, 41
 
OUT 41 H
Out at port B
800F 
CD, 20, 80
 
CALL DELAY
Calling the delay sub-routine
8012
2C
 
INR L
Pointing to the next location
8013
0D
 
DCR C
Decrement the counter
8014
C2, 0C, 80
 
JNZ AGAIN
If not exhausted go again
8017
76
 
HLT
Stop
8020
C5
DELAY:
PUSH B
Saving B. This delay subroutine uses 2 single registers A & D and 1 register pair BC
8021
F5
 
PUSH PSW
Saving PSW
8022
16, 0F
 
MVI D, 0F H
Loading counter for outer loop
8024
01, 00, 10
ST:
LXI B, 1000 H
Loading counter for inner loop
8027
0B
L:
DCX B
Decrement inner counter
8028
79
 
MOV A, C
If not exhausted go again for inner loop
8029
B0
 
ORA B
 
802A 
C2, 27, 80
 
JNZ L
 
802D 
15
 
DCR D
Decrement outer counter
802E 
C2, 24, 80
 
JNZ ST
If not exhausted go again for outer loop
8031
F1
 
POP PSW
Restore PSW
8032
C1
 
POP B
Restore B
8033
C9
 
RET
Return to the calling program

 

 

 

Updated on: 30-Jul-2019

699 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements