You are on page 1of 4

Digital Clock Program -12/24 Hours

Aim : To write an assembly language program to simulate digital clock using


8085.

Theory: The hours, minutes, and seconds are entered at the memory locations
which is in decimal form. The enetered data is converted into the format from
decimal. A delay of exactly one second is generated and after each delay, the
seconds, minutes and hours information is updated. The processing of data is
done in hex. form and converted back into decimal before displaying.

Algorithm :
Step 1: Start the program.
Step 2: Load seconds, minutes and hours in the memory.
Step 3: Display hours, minutes and seconds.
Step 4: Convert time information into Hex. format from decimal.
Step 5: Call delay routine for exactly one second.
Step 6: Increment seconds.
Step 7: If second is greater than 60, reset seconds to 00 and increment
minutes.
Step 8: If minutes is greater than 60, reset minutes to 00 and increment
hours.
Step9: If hour is greater than24, reset second, minutes, hours to 00.
Step 10: Convert time information back into decimal format.
Step 11: Go to step 3.
Step 12. Stop the program.

Befin Skaria

Program
Mem.
Addrs:

OpCode

8800
8801
8802
8803

21
00
00
22

8804
8805
8806

EF
8F
CD

8807
8808
8809
880A
880B
880C
880D
880E
880F

00
80
0E
00
79
32
F1
8F
CD

8810
8811
8812

Label Mnemonics

Comments

LXI H,0000

[HL] [0000]

SHLD 8FEF

The contents of register of L are stored


athe mem. Location specified and the
contents of register H are stored at the
next mem. Location by inc. the operand
by 1

CALL 8000

Call 8000 contnet


(Update the data in address field)

MVI C, 00

[C] 00

MOV A,C
STA 8FF1

[A]
[C]
[8FF1]
[A]

CALL 8010

Call 8010 content


(Updating to the data field)

10
80
CD

CALL 8020

Call 8020 content


(Creating a delay exactly for one sec.)

8813
8814
8815
8816

20
80
79
3C

MOV A,C
INR A

8817
8818
8819
881A
881B
881C
881D
881E
881F

27
4F
FE
60
C2
0B
88
7D
3C

DAA
MOV C,A
CPI 60

[A]
[C]
[A]
[A]+01
(Increment content of the acc. By one)
Decimal adjust acc.
[C]
[A]
Compare immediate with every 60

JNZ 880B

If [Z]0, go to 880B

MOV A,L
INR A

8820
8821
8822

27
6F
FE

DAA
MOV L,A
CPI 60

[A]
[L]
[A]
[A]+01
(Increment content of the acc. By one)
Decimal adjust acc.
[L]
[A]
Compare immediate with every 60

L1:

L2:

Befin Skaria

8823
8824
8825
8826
8827

60
C2
0B
88
AF

JNZ 880B

If [Z]0, go to 880B

XRA A

8828
8829
882A

4F
7E
3C

MOV C,A
MOV A,M
INR A

The contents of the register exclusive or


with the acc.
[C]
[A]
[A]
[M]
[A]
[A]+01
(Increment content of the acc. By one)

882B
882C
882D
882E
882F
8830
8831
8832
8833
8834

27
77
EC
24
C2
0B
88
C3
03
88

DAA
MOV M,A
CPI 24

[M]
[A]
Compare immediate with every 24

JNZ 880B

If [Z]0, go to 880B

JMP 8803

If [Z]0, go to 8803

CALL UPDAD
8000
8001
8002
8003
8004
8005
8006
8007
8008
8009
800A
880B

E5
D5
C5
F5
CD
40
04
F1
C1
D1
E1
C9

PUSH H
PUSH D
PUSH B
PUSH PSW
CALL 0440

E5
D5
C5
F5
CD
4C
04
F1
C1
D1
E1
C9

PUSH H
PUSH D
PUSH B
PUSH PSW
CALL 044C

11
FF

LXI D, FFFF

POP PSW
POP B
POP D
POP H
RET

CALL UPDDT
8010
8011
8012
8013
8014
8015
8016
8017
8018
8019
801A
801B

POP PSW
POP B
POP D
POP H
RET

CALL DELAY
8020
8021

Befin Skaria

8022
8023
8024
8025
8026
8027
8028
8029
802A
802B
802C
802D
802E
802F
8030

FF
1B
7A
AB
C2
23
80
11
00
90
1B
7A
AB
C2
C9

DCX D
MOV A,D
XRA E
JNZ 8023

LXI D, 9000

DCX D
MOV A,D
XRA E
JNZ 802C
RET

Befin Skaria

You might also like