Question

In: Electrical Engineering

Write an assembly language program for 8051 microcontroller to find the sum of the following series,...

Write an assembly language program for 8051 microcontroller to find the sum of the following

series,

1, -2, +3, -4, +5, -6,..., up to 100 terms.

Store lower byte in R0 and higher byte in R1.

Solutions

Expert Solution

                  // In the sereis all even numbers are negive and odd numbers are positive
                
                  ORG 000h
                  MOV R1,#64H       //Enter the final number of Series
                  MOV A,#00H        //Initilize the Accumulator with zero
         AGAIN:   MOV R0,R1         // Copy the contenets of R1 to R0
                  RRC R0            //Rotate R0 once to right if carry is zero then it is even number else odd number
                  JNC EVEN_Number   //if carry is not set then even nuber and jump to EVEN_Number location
                  JC ODD_Number     //if carry is set then odd nuber and jump to ODD_Number location
   EVEN_Number:   CPL R0            //ones complement R0
                  ADD R0, #01H      //Add one to complemented number
   ODD_Number:    ADD A,R0          //Add Ro to Acummulator
                  DJNZ R1, AGAIN    //Decrement R1 if not zero jumber AGAIN location else continue
                  MOV R2,A          //Move the final ansuer from Acummulator to R2
                  END               // End the program


Related Solutions

write a assembly language program to convert GRAY to BCD code in 8051
write a assembly language program to convert GRAY to BCD code in 8051
Write an 8051-assembly language program for the interfacing of ADC0804 and LM35 to display the room...
Write an 8051-assembly language program for the interfacing of ADC0804 and LM35 to display the room temperature on 16x2 LCD (10marks) please note that the program should be interfacing with ADC0804.
Describe the types and differences in the assembly instructions of 8051 microcontroller
Describe the types and differences in the assembly instructions of 8051 microcontroller
write a program for the microcontroller-msp430fr6989 using code composer studio not assembly language. write a code...
write a program for the microcontroller-msp430fr6989 using code composer studio not assembly language. write a code that transmits a single character and lights the red LED upon receiving that character. The board will "talk" to itself. The green LED should turn on whenever a message is sent and the LCD will display the message being received.
Write an X86-series assembly language program that checks whether input string is palindrome or not. A...
Write an X86-series assembly language program that checks whether input string is palindrome or not. A palindrome is a word, number, phrase or any other sequence which reads the same backward as forward e.g. madam, racecar. Sample Execution: Please enter a String: redivider The string is a palindrome Another Sample Execution: Please enter a String: abracadabra The string is not a palindrome
Q1: A. WRITE AN ASSEMBLY LANGUAGE PROGRAM TO EXCHANGE 16-BIT NUMBERS B. WRITE AN ASSEMBLY LANGUAGE...
Q1: A. WRITE AN ASSEMBLY LANGUAGE PROGRAM TO EXCHANGE 16-BIT NUMBERS B. WRITE AN ASSEMBLY LANGUAGE PROGRAM TO SOLVE THE EQUATION Z=A+B-(C/D)+E please write the answer separately part A its own code and part B its own code this is microprocessor the ASSEMBLY LANGUAGE emu8086 should be written like this EX: mov ax,100h mov bx,200h etc
Write a program in MIPS assembly language to perform the calculation of the following equation and...
Write a program in MIPS assembly language to perform the calculation of the following equation and save the result accordingly:    f = 5x + 3y + z Assumptions: - Registers can be used to represent variables x, y, z, and f - Initialize x, y, and z to values of your choice. f can be initialized to zero. - Use comments to specify your register usage and explain your logic
Write a code of digital alarm clock 8051 microcontroller using pin AT89S52
Write a code of digital alarm clock 8051 microcontroller using pin AT89S52
-Write a program in C++: • to find the sum of the series 1! /1+2! /2+3!...
-Write a program in C++: • to find the sum of the series 1! /1+2! /2+3! /3+4! /4+5! /5 using the function1, • to convert decimal number to binary number using the function2, • to check whether a number is a prime number or not using the function3, • to check whether two given strings are an anagram using the function4. important must do in (Multi-Filing) of c++
using Windows 32 bit framework , Write an assembly language program to find the second minimum...
using Windows 32 bit framework , Write an assembly language program to find the second minimum element (formally, second minimum is larger than the minimum but smaller than all the other elements in the array) of an array of size 100. Note: You can define the array as nbrArray DWORD 23 45 21 67 78 95 dup(?) and show that your program works for the first five elements. Display the second minimum in a message box using Input output macro
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT