Question

Write a program in which the number 5H is added 20 times and the result is...

Write a program in which the number 5H is added 20 times and the result is finally stored in R0.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Solving the above problem in Assembly language for Micro controller 8051:

MOV R0, #05H; // Loading Register R0 with value 5H

MOV R1, #20H; // Using R1 as counter. Moving 20H to Register R1

MOV A, #00H; // Initialising Accumulator value with 00H

UP: ADD A, R0; // Adding 5H to Acc. value by creating a loop with lable UP

DJNZ R1, UP // Loop continues untill R1 counter value becomes 0. DJNZ will decrement R1 value by 1 and // jumps to label UP untill R1 becomes 0. Thus repetitive addition of 5H in Accumulator 20 times

MOV R0, A // Finally move the Accumulator result in Registor R0

Add a comment
Know the answer?
Add Answer to:
Write a program in which the number 5H is added 20 times and the result is...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Python Write a program which reads in a string and an signifying the number times the...

    Python Write a program which reads in a string and an signifying the number times the string should be repeated. The program should then output the string N times. integer N, You can assume all input will be valid. Example: Enter a string: hello How many times to repeat? 5 hello hello hello hello hello Example: T Enter a string: goodbye Ty How many times to repeat? 32 goodbye goodbye [... goodbye 30 more times]

  • Question 20 (5 points) A number is added to 9. The result is then multiplied by...

    Question 20 (5 points) A number is added to 9. The result is then multiplied by 4 to give a new result of 120. What is the number? a) 4(n+9) + 120 b) 21 c) 489 d) 39

  • Write a C program that prompts the user for the number for times the user wants...

    Write a C program that prompts the user for the number for times the user wants to flip a coin. Your program will flip a virtual coin that number of times and return the following: 1) The number of times heads occurred. 2) The number of times tails occured. Then take the coin flip program and modify the random number generator to roll a single 6-sided dice.   DO NOT DISPLAY THE RESULTS OF EACH ROLL. 1) Ask the user how...

  • 2) Write a program in C/C++ that asks the user to enter a number then the...

    2) Write a program in C/C++ that asks the user to enter a number then the user's input value is passed to a function which increments the number by 10 and returns the result of the incrementation. Write the program to accomplish the increment using three (3) different techniques. To test each technique separately, the user should enter a different number for each of the three (3) techniques. Make sure that you compile and execute your program. Finally, provide screenshots...

  • If three times a number, added to 2 is divided by the number plus 7, the...

    If three times a number, added to 2 is divided by the number plus 7, the result is eight thirds. Find the number. The number is

  • 3. Write a program in assembly language that reads a number from the keyboard and displays...

    3. Write a program in assembly language that reads a number from the keyboard and displays it on the screen. 4. Write a program in assembly language to ask two digits from the user, store the digits in the EAX and EBX register, respectively, add the values, store the result in a memory location 'res' and finally display the result.

  • In Java* ​​​​​​​ Write a program that reads an arbitrary number of 20 integers that are...

    In Java* ​​​​​​​ Write a program that reads an arbitrary number of 20 integers that are in the range 0 to 100 inclusive. The program will ask a user to re-enter an integer if the user inputs a number outside of that range. The inputted integers must then be stored in a single dimensional array of size 20. Please create 3 methods: 1. Write a method public static int countEven(int[] inputArray) The method counts how many even numbers are in...

  • please write in python Write a program that asks for beginning and ending number. The program...

    please write in python Write a program that asks for beginning and ending number. The program generates a set of 20 random numbers between the numbers and displays a count of each number generated. Sample output Enter starting and ending number separated by comma: 5, 25 5 occurs 2 times 7 occurs 1 time 8 occurs 1 time 10 occurs 2 times 12 occurs 1 time 13 occurs 2 time 15 occurs 5 times 16 occurs 1 time 20 occurs...

  • In this assignment, you are going to write a program that will calculate x*x by using shift opera...

    Please solved IAR workbench in C language I have a limited time less than 10 hours In this assignment, you are going to write a program that will calculate x*x by using shift operations. Details are as follows: x can be any number between 1 - 100. The result x*x will be stored in 0x20000000. You may first find the binary representation of x. In the binary representation, if you see a 1 in the nth bit, you will shift...

  • Write a program in assembly language that loads register R2 with the word in memory location...

    Write a program in assembly language that loads register R2 with the word in memory location which is 10 bytes above the address in R0; and loads register R3 with the word in memory location which is 10 bytes below the address in R1. Your program must compare the two numbers in R2 and R3. If number in R2 is less than or equal to the number in R3 it must add the two numbers and save the result in...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT