Simulate decimal up counter in 8085 Microprocessor

8085MicrocontrollerMicroprocessor

Here we will see one 8085 Microprocessor program. In this program we will see how to simulate the decimal up counter.

Problem Statement

 Write an 8085 Assembly language program to simulate the decimal up counter. That will count from 0 through 9. Then come back to 0 again.

Discussion

 In this section we are simulating the decimal up counter. Here the counter will count 100 decimal numbers from 0 to 99. All values will be updated in each 0.5 seconds. For decimal count we are using the DAA instruction.

 Note: Here for simplicity we are storing the numbers into memory. To simulate it like a counter we can use 7-segment display to show the numbers

Input

Here we are not providing any input.

Flow Diagram

Program

Address
HEX Codes
Labels
Mnemonics
Comments
F000
AF
 
XRA A  
Initialize A with 00H
F001
32, 00, 80
LOOP
STA 8000H  
Store A into 8000H
F004
CD, 10, F0
 
CALL DELAY
Wait for 0.5 second
F007
3A, 00, 80
 
LDA 8000H  
Get back the data from 8000H
F00A
C6, 01
 
ADI 01H
Add 01H with the number
F00C
27
 
DAA
Decimal adjust
F00D
C3, 01, F0
 
JMP LOOP  
Jump to LOOP
F010
01, FF, FF
DELAY
LXI B,FFFFH  
Initialize BC register pair to FFFFH
F013
0B
L1
DCX B  
Decrease BC
F014
78
 
MOV A,B
Take B to A
F015
B1
 
ORA C  
OR C and E
F016
C2, 13, F0
 
JNZ L1
If Z = 0, jump to L1
F014
C9
 
RET
Return from subroutine

 

Output

                The numbers are storing into memory location 8000H.

 

raja
Published on 04-Oct-2019 16:13:29
Advertisements