Sie sind auf Seite 1von 2

Befin Skaria Digital Clock ProgramDigital Clock ProgramDigital Clock ProgramDigital Clock Program

----12/24 Hours12/24 Hours12/24 Hours12/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 entered 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: Op- Code Label Mnemonics Comments
8800 21 LXI H,0000 [HL][0000] 8801 00 8802 00 8803 22 L1: 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 8804 EF 8805 8F 8806 CD CALL 8000
Call 8000 contnet (Update the data in address field) 8807 00 8808 80 8809 0E MVI C, 00
[C]00 880A 00 880B 79 L2: MOV A,C [A][C] 880C 32 STA 8FF1 [8FF1][A] 880D
F1 880E 8F 880F CD CALL 8010 Call 8010 content (Updating to the data field) 8810 10 8811 80
8812 CD CALL 8020 Call 8020 content (Creating a delay exactly for one sec.) 8813 20 8814 80
8815 79 MOV A,C [A][C] 8816 3C INR A [A][A]+01 (Increment content of the acc. By one)
8817 27 DAA Decimal adjust acc. 8818 4F MOV C,A [C][A] 8819 FE CPI 60 Compare
immediate with every 60 881A 60 881B C2 JNZ 880B If [Z]0, go to 880B 881C 0B 881D 88 881E
7D MOV A,L [A][L] 881F 3C INR A [A][A]+01 (Increment content of the acc. By one) 8820
27 DAA Decimal adjust acc. 8821 6F MOV L,A [L][A] 8822 FE CPI 60 Compare immediate with
every 60
Befin Skaria 8823 60 8824 C2 JNZ 880B If [Z]0, go to 880B 8825 0B 8826 88 8827 AF XRA A The
contents of the register exclusive or with the acc. 8828 4F MOV C,A [C][A] 8829 7E MOV A,M
[A][M] 882A 3C INR A [A][A]+01 (Increment content of the acc. By one) 882B 27 DAA
882C 77 MOV M,A [M][A] 882D EC CPI 24 Compare immediate with every 24 882E 24 882F
C2 JNZ 880B If [Z]0, go to 880B 8830 0B 8831 88 8832 C3 JMP 8803 If [Z]0, go to 8803 8833 03
8834 88 CALL UPDAD 8000 E5 PUSH H 8001 D5 PUSH D 8002 C5 PUSH B 8003 F5 PUSH PSW
8004 CD CALL 0440 8005 40 8006 04 8007 F1 POP PSW 8008 C1 POP B 8009 D1 POP D 800A
E1 POP H 880B C9 RET CALL UPDDT 8010 E5 PUSH H 8011 D5 PUSH D 8012 C5 PUSH B 8013
F5 PUSH PSW 8014 CD CALL 044C 8015 4C 8016 04 8017 F1 POP PSW 8018 C1 POP B 8019
D1 POP D 801A E1 POP H 801B C9 RET CALL DELAY 8020 11 LXI D, FFFF 8021 FF
Befin Skaria 8022 FF 8023 1B DCX D 8024 7A MOV A,D 8025 AB XRA E 8026 C2 JNZ 8023 8027
23 8028 80 8029 11 LXI D, 9000 802A 00 802B 90 802C 1B DCX D 802D 7A MOV A,D 802E AB
XRA E 802F C2 JNZ 802C 8030 C9 RET

Das könnte Ihnen auch gefallen