In the third year of the B.Sc. Physics practical program under TANSCHE, it's crucial to grasp how microprocessors work. A significant part of this involves the Microprocessor 8085, which is a popular 8-bit processor. In this experiment, students get to practice basic arithmetic operations.
This blog post will highlight the experiment on finding the 2's complement of 8-bit/16-bit Numbers using the Microprocessor 8085. This hands-on activity helps students dive into the essential features of the 8085 microprocessor, including programming logic and memory functions. By completing this task, you'll develop a clear understanding of how the 8085 processes data and performs arithmetic operations, laying a strong groundwork in microprocessor systems.
Microprocessor 8085 program to find 2's complement
Aim:
Write an assembly language program to find 2’s complement numbers using microprocessor 8085.
Apparatus required:
Microprocessor 8085 kit, power supply etc
Program:
2’s complement of 8-bit
Memory address | Machine code | Mnemonics | Operands | Comments |
8000 | 3A | LDA | 8501H | Load the data in accumulator |
8001 | 01 | |||
8002 | 85 | |||
8003 | 2F | CMA | Complement the accumulator | |
8004 | 3C | INR | A | 2’s complement of the number |
8005 | 32 | STA | 8502H | Store the result in the memory location 8502 |
8006 | 02 | |||
8007 | 85 | |||
8008 | 76 | HLT | Stop the program |
Example:
2’s complement of 8-bit number
First input location 8501H - 14H (In binary form 0001 0100) + 1
Result location 8502H - ECH (In binary form (1110 1100)
YouTube Demo:
2’s complement of 16-bit
Memory address | Machine code | Mnemonics | Operands | Comments |
8000 | 21 | LXI | H, 8501H | Address of the LSB of the number |
8001 | 01 | |||
8002 | 85 | |||
8003 | 06 | MVI | B, 00H | B register to store carry |
8004 | 00 | |||
8005 | 7E | MOV | A, M | Move LSB from memory to accumulator |
8006 | 2F | CMA | 1’s complement of LSB | |
8007 | C6 | ADI | 01 | 2’s complement of LSB |
8008 | 01 | |||
8009 | 32 | STA | 8503H | Store the LSB to 8503H |
800A | 03 | |||
800B | 85 | |||
800C | D2 | JNC | 8010H | Is No-carry? Go to 8010H |
800D | 10 | |||
800E | 80 | |||
800F | 04 | INR | B | Increment B register by 1 |
8010 | 23 | INX | H | MSB of the number |
8011 | 7E | MOV | A, M | Move LSB from memory to accumulator |
8012 | 2F | CMA | 1’s complement of LSB | |
8013 | 80 | ADD | B | Add this to register B |
8014 | 32 | STA | 8504H | Store the MSB to 8504H |
8015 | 04 | |||
8016 | 85 | |||
8017 | 76 | HLT | Stop the program |
Example:
2’s complement of 16-bit number
First input location 8501H - 14H (In binary form 0001 0100)
Second input location 8502H - 15H (In binary form 0001 0101)
Result location 8503H - EAH (In binary form (1110 1011)
Result location 8504H - ECH (In binary form (1110 1010)
YouTube Demo:
Procedure:
Result:
The assembly programmes for microprocessor 8085 for finding the 2’s complement of 8-bit/16-bit numbers were written and executed using the microprocessor 8085 kit.
0 Comments
It's all about friendly conversation here : )
I'd love to hear your thoughts!
Be sure to check back again because I do make every effort to reply to your comments here.
Please do not post your website link here.