0% found this document useful (0 votes)
10 views8 pages

Digital Clock Simulation

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views8 pages

Digital Clock Simulation

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 8

Digital Clock Simulation

Aim

To simulate a digital clock using the 8085 microprocessor.

Algorithm

1. Read the input time.


2. Display the current time.
3. Wait for one second.
4. Increment the second.
5. If seconds equal 60, increment the minute.
6. If minutes equal 60, increment the hour.
7. If hours equal 24, reset to 00.
8. Loop back to display the updated time.

Program

Address Label Mnemonics Opcode


8000 CALL INPUT CD 00 82
8003 LOOP CALL DISPLAY CD 00 83
8006 CALL DELAY CD 00 84
8009 CALL SECOND CD 00 85
800C JMP LOOP C3 03 80
800F HLT 76
8200 INPUT MVI B,00 06 00
8202 MVI C,03 0E 03
8204 LXI D,0000 11 00 00
8207 LXI H,8100 21 00 81
820A LPI CALL 03 BA CD BA 03
820D RLC 07
820E RLC 07
820F RLC 07
8210 RLC 07
8211 MOV B,A 47
8212 CALL 03BA CD BA 03
8215 ADD B 80
8216 INX H 23
8217 MOV M,A 77
8218 DCR C 0D
8219 JNZ LP1 C2 0A 82
821C RET C9
8300 DISPLAY LDA 8101 3A 01 81
8303 STA 8FF0 32 F0 8F
8306 LDA 8102 3A 02 81
8309 STA 8FF1 32 EF 8F
Address Label Mnemonics Opcode
830C LDA 8103 3A 03 81
830F STA 8FF1 32 F1 8F
8312 CALL 0440 CD 40 04
8315 CALL 044C CD 4C 04
8318 RET C9
8400 DELAY MVI B,02 06 02
8402 LP2 LXI D,FFFF 11 FF FF
8405 LP1 DCX D 1B
8406 MOV A,E 7B
8407 ORA D B2
8408 JNZ LP1 C2 05 84
840B DCR B 05
840C JNZ LP2 C2 02 84
840F RET C9
8500 SECOND LDA 8103 3A 03 81
8503 MOV D,A 57
8504 INR D 14
8505 MOV A,D 7A
8506 DAA 27
8507 STA 8103 32 03 81
850A CPI 60 FE 60
850C RNZ C0
850D MVI D,00 16 00
850F MOV A,D 7A
8510 STA 8103 32 03 81
8513 CALL MINUTE CD 00 86
8516 RET C9
8600 MINUTE LDA 8102 3A 02 81
8603 MOV B,A 47
8604 INR B 04
8605 MOV A,B 78
8606 DAA 27
8607 STA 8102 32 02 81
860A CPI 60 FE 60
860C RNZ C0
860D MVI B,00 06 00
860F MOV A,B 78
8610 STA 8102 32 02 81
8613 CALL HOUR CD 00 87
8616 RET C9
8700 HOUR LDA 8101 3A 01 81
8703 MOV H,A 67
8704 INR H 24
8705 MOV A,H 7C
Address Label Mnemonics Opcode
8706 DAA 27
8707 STA 8101 32 01 81
870A CPI 24 FE 24
870C RNZ C0
870D MVI H,00 26 00
870F MOV A,H 7C
8710 STA 8101 32 01 81
8713 RET C9

Output:

12 00 00 – 12 00 01
12 00 02
12 00 03
12 00 04
12 00 05

RESULT:
The digital clock will display the current time, incrementing the seconds, minutes, and hours
accordingly.

Rolling Display
Aim

To display scrolling text on an LED display using the 8085 microcontroller.

Algorithm

1. Load the starting address of the message into the register pair.
2. Initialize the display.
3. Display the first character on the LED display.
4. Introduce a short delay.
5. Shift the display to the left.
6. Display the next character from the message.
7. Repeat steps 4-6 until the entire message has scrolled through the display.
8. Loop back to the starting point to continuously scroll the message.

Program:
ADDRESS LABEL MNEMONICS OPCODE

8000 MAIN CALL DISPLAY CD 00 81

8003 CALL DELAY CD 00 82

8006 CALL SHIFT CD 00 83

8009 JMP MAIN C3 00 80

8100 DISPLAY MVI C,06 0E 06

8102 MVI B,90 06 90

8104 LXI H,9000 21 00 90

8107 L1 MOV A,B 78

8108 OUT 31 D3 31

810A MOV A,M 7E

810B OUT 30 D3 30

810D INX H 23

810E INR B 04

810F DCR C 0D

8110 JNZ L1 C2 07 81

8113 RET C9

8200 DELAY LXI D,FFFF 11 FF FF


8203 L2 DCX D 1B

8204 MOV A,D 7A

8205 ORA E B3

8206 JNZ L2 C2 03 82

8209 RET C9

8300 SHIFT MVI C,06 0E 06

8302 LXI H,9000 21 00 90

8305 MOV B,M 46

8306 LXI D,9001 11 01 90

830A RIG LDAX D 1A

830B MOV M,A 77

830C INX H 23

830D INX D 13

830E DCR C 0D

830F JNZ RIG C2 0A 83

8312 MOV M,B 70

8313 RET C9

OUTPUT:

ADDRESS DATA
9000 67
9001 97
9002 83
9003 83
9004 F3
9005 00
RESULT:
Thus the rolling display using 8085 microprocessor is done successfully.

8085 Stepper Motor

Aim:

To control the rotation of a stepper motor using the 8085 microcontroller.

Algorithm:

1. Initialize: Configure control pins as output for the stepper motor.


2. Rotate Forward: Set direction forward and rotate for a specific number of steps.
3. Delay: Introduce a short delay between steps.
4. Rotate Backward: Change direction and repeat step 2 for backward rotation.
5. Repeat: Loop steps 2 to 4 to continuously alternate between forward and backward
rotation.

Program:

ADDRESS LABEL MNEMONICS OPCODE


8000 MVI C, C8 0E C8
8002 MVI A, 80 3E 80
8004 OUT 43 D3 43
8006 MVI A, 11 3E 11
8008 L1 OUT 40 D3 40
800A PUSH PSW F5
800B CALL DELAY CD 00 84
800E POP PSW F1
800F RRC 0F
8010 DCR C 0D
8011 JNZ L1 C2 08 80
8014 MVI C, C8 0E C8
8016 L2 OUT 40 D3 40
8018 PUSH PSW F5
8019 CALL DELAY CD 00 84
801C POP PSW F1
801D RLC 07
801E DCR C 0D
801F JNZ L2 C2 16 80
8022 JMP L1 C3 08 80
8025 HLT 76
8400 DELAY
8400 LOOP2 MVI B, 02 06 02
8402 LOOP3 LXI D, FFFF 11 FF FF
8405 DCX D 1B
8406 MOV A, E 7B
8407 ORA D B2
8408 JNZ LOOP3 C2 05 84
840B DCR B 05
840C JNZ LOOP2 C2 02 84
840F RET C9
RESULT:

Thus the stepper motor using 8085 microprocessor is done successfully.

You might also like