Found 409 Articles for Microcontroller

8085 program to find 1's and 2's complement of 16-bit number

Vrundesha Joshi
Updated on 30-Jul-2019 22:30:24

2K+ Views

In this program we will see how to find 1's complement and 2's complement of a 16-bit number.Problem StatementWrite 8085 Assembly language program to find 1's complement and 2's complement of a16-bit number stored in 8000H and 8001H.Discussion8085 has an instruction CMA. This instruction complements the content of Accumulator. For 1's complement CMA instruction is sufficient, and for 2's complement we have to increase the number by 1 after complementing.For 16-bit number, we are taking the number into HL pair, but for complementing we have to copy the numbers to Accumulator from H and L one by one. Then by ... Read More

8085 program to find 1's and 2's complement of 8-bit number

Rishi Rathor
Updated on 30-Jul-2019 22:30:24

6K+ Views

In this program we will see how to find 1's complement and 2's complement of an 8-bit number.Problem StatementWrite 8085 Assembly language program to find 1's complement and 2's complement of a number stored in 8000H.Discussion8085 has an instruction CMA. This instruction complements the content of Accumulator. For 1's complement CMA instruction is sufficient, and for 2's complement we have to increase the number by 1 after complementing.We are taking the number from 8000H and storing the 1's complement at location 8050H, and 2's complement to 8051H.InputAddressData......8000AB......Flow DiagramProgramAddressHEX CodesMnemonicsCommentsF0003A, 00, 80LDA 8000HLoad the number from memoryF0032FCMAComplement the accumulatorF00432, 50, 80STA ... Read More

8085 program to count total even numbers in series of 10 numbers

Anvi Jain
Updated on 30-Jul-2019 22:30:24

860 Views

In this program we will see how to count number of even numbers in a block of elements.Problem StatementWrite 8085 Assembly language program to count number of even numbers in a block of data, where the block size is 10D. The block is starting from location8000H.DiscussionThe Odd Even checking is very simple. we can determine one number is odd or even by checking only the LSb. When LSb is 1, the number is odd, otherwise it is even. In this program we are taking a number from memory and then ANDing01H with it. if the result is nonzero, then the ... Read More

8085 program to count number of once in the given 8-bit number

Vrundesha Joshi
Updated on 30-Jul-2019 22:30:24

778 Views

In this program we will see how to count number of 1's in an 8-bit number.Problem StatementWrite 8085 Assembly language program to count number of 1s in 8-bit number stored atlocation 8000H.DiscussionIn this program we areusing the rotate operation to count the number of 1's. As there are8 different bits in 8-bit number, then we are rotating the numbereight times. we can use RRC or RLC. Here we have used the RRCinstruction. This instruction sends the LSb to MSb also to carryflag. So after each iteration we can check the carry status to getthe count of 1s.If the number is ... Read More

8085 program to find the sum of first n natural numbers

Rishi Rathor
Updated on 30-Jul-2019 22:30:24

2K+ Views

In this program we will see how to add first n natural numbers.Problem StatementWrite 8085 Assembly language program to add first N natural numbers. The value of N is provided.DiscussionWe are getting the value of N from memory location 8000H. We are using the number N as count variable, in each step we are calculating (A + Count) value, and store them into A. After adding them, the count value is decreased, thus the total series is completed.If the number is 23H(35D), then the sum will be (35*36)/2 = 630 (276H)InputAddressData......800023......Flow DiagramProgramAddressHEX CodesLabelsMnemonicsCommentsF00021, 00, 80LXI H, 8000HPoint to get the ... Read More

8085 program to find sum of digits of 8 bit number

Rishi Rathor
Updated on 30-Jun-2020 05:01:51

776 Views

In this program we will see how to add the digits of an 8-bit number.Problem StatementWrite 8085 Assembly language program to add the digits of an 8-bit number stored in memory location 8000H.DiscussionTo get the digits of an 8-bit number, we can use the masking operation. At first we will mask the upper nibble, and then the lower nibble. After masking the lower nibble, we have to rotate it to the right to make it least significant nibble. Then we can simply add it to the stored nibble to get the sum.InputAddressData......80008A......ProgramAddressHEX CodesMnemonicsCommentsF0003A, 00, 80LDA 8000HLoad the number into AF0034FMOV ... Read More

8085 program to add 2-BCD numbers

Jennifer Nicholas
Updated on 30-Jul-2019 22:30:24

4K+ Views

In this program we will see how to add two 8-bit BCD numbers.Problem StatementWrite 8085 Assembly language program to add two 8-bit BCD number stored in memory location 8000H – 8001H.DiscussionThis task is too simple. Here we are taking the numbers from memory and after adding we need to put DAA instruction to adjust the accumulator content to decimal form. The DAA will check the AC and CY flags to adjust a number to its decimal form.InputAddressData......800099800125......Flow DiagramProgramAddressHEX CodesLabelsMnemonicsCommentsF00021, 00, 80LXI H, 8000HPoint to first operandF0037EMOV A, MLoad A with first operandF00423INX HPoint to next operandF00586ADD MAdd Acc and memory ... Read More

8085 program to add two 16 bit numbers

Rishi Rathor
Updated on 30-Jul-2019 22:30:24

13K+ Views

In this program we will see how to add two 16-bit numbers.Problem StatementWrite8085 Assembly language program to add two 16-bit number stored in memory location 8000H – 8001H and 8002H – 8003H.DiscussionIn this program we are pointing the operand addresses using HL and DE register pair. Then adding LSBytes by ADD operator, and after that adding MSBytes using ADC operator to consider the carry flag result. The 16-bit result will be stored at BC register, and by checking the carry bit after addition we can simply put 1 into memory.We are taking two numbersBCAD + FE2D = 1BADAInputAddressData......8000AD8001BC80022D8003FE......Flow DiagramProgramAddressHEX CodesLabelsMnemonicsCommentsF00021, ... Read More

Program to Find the smallest number in an array of data in 8085 Microprocessor

Vrundesha Joshi
Updated on 30-Jul-2019 22:30:24

10K+ Views

In this program we will see how to find the smallest number from a block of bytes using 8085.Problem StatementWrite 8085 Assembly language program to find the smallest number from a block of bytes.DiscussionIn this program the data are stored at location 8001H onwards. The 8000H is containing the size of the block. After executing this program, it will return the smallest number and store it at location 9000H.Logic is simple, we are taking the first number at register B to start the job. In each iteration we are getting the number from memory and storing it into register A. ... Read More

Program to Find the largest number in an array of data in 8085 Microprocessor

Rishi Rathor
Updated on 30-Jul-2019 22:30:24

19K+ Views

In this program we will see how to find the largest number from a block of bytes using 8085.Problem StatementWrite 8085 Assembly language program to find the largest number from a block of bytes.DiscussionIn this program the data are stored at location 8001H onwards. The 8000H is containing the size of the block. After executing this program, it will return the largest number and store it at location 9000H.Logic is simple, we are taking the first number at register B to start the job. In each iteration we are getting the number from memory and storing it into register A. ... Read More

Advertisements