- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
8085 program to alternate D0 bit with specified delay
Now let us see a program of Intel 8085 Microprocessor. In this program we will see how to alternate the D0 bit and send as output.
Problem Statement
Write 8085 Assembly language program to alternate D0 bit. And send this as output.
Discussion
Alternating D0 bit and sending as output is like generating the square wave. We are adding extra delay in each phase. To generate square wave with 8085, we will rotate 10101010 (AAH) continuously, and send D0 as output. We will mask the accumulator content by 01H. If this is 0, then output will be 0, if it is 1, output will be 1, thus the pulse will be generated. After sending it, it will wait for some time using delay subroutine.
Input
No input is given in this case
Flow Diagram
Program
Address | HEX Codes | Labels | Mnemonics | Comments |
---|---|---|---|---|
8000 | 16, AA | | MVI D,AAH | Load 10101010 into D |
8002 | 7A | ROTATE | MOV A,D | Load D to A |
8003 | 07 | | RLC | Rotate A to the left |
8004 | 57 | | MOV D,A | Store A into D again |
8005 | E6, 01 | | ANI 01H | Mask A with 01H |
8007 | D3, 10 | | OUT 10H | Send output to port 10 |
8009 | CD, 0F, 80 | | CALL DELAY | Wait for some time |
800C | C3, 02, 80 | | JMP ROTATE | Jump to ROTATE for next phase |
800F | C5 | DELAY: | PUSH B | Saving B. This delay subroutine uses 2 single registers A & D and 1 register pair BC |
8010 | F5 | | PUSH PSW | Saving PSW |
8011 | 16, 0F | | MVI D, 0F H | Loading counter for outer loop |
8013 | 01, 00, 10 | ST: | LXI B, 1000 H | Loading counter for inner loop |
8016 | 0B | L: | DCX B | Decrement inner counter |
8017 | 79 | | MOV A, C | If not exhausted go again for inner loop |
8018 | B0 | | ORA B | |
8019 | C2, 27, 80 | | JNZ L | |
801C | 15 | | DCR D | Decrement outer counter |
801D | C2, 24, 80 | | JNZ ST | If not exhausted go again for outer loop |
8020 | F1 | | POP PSW | Restore PSW |
8021 | C1 | | POP B | Restore B |
8022 | C9 | | RET | Return to the calling program |
Output
Alternating D0 will be reflected as output like square wave.
Advertisements