Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I understand the math to the following problem, however I'm not sure how to code this in msp430 assembly language. I have the structure given

I understand the math to the following problem, however I'm not sure how to code this in msp430 assembly language. I have the structure given to me and I'll repost it down below. The summation of X should be equal to 310 (136h in hex) which in turn makes F equal to 90(5Ah in hex). Some help would be amazing!

Implement the following arithmetic function using subroutines and develop the code to be as efficient as possible. The only input to the function is variable (a) that is initialized in register R4 at the beginning of the program to 5 and maintained thereafter. The X calculation result (X) is stored in R5. The final answer (F) is stored in R7. Register R0-R3 are never to be used since they have designated purpose in the MSP430 Launchpad.

F = ((X+50)/4) where X= the summation of (2(i!)) i=0 to i=|a|

Write an MSP430 assembly language program that implements the above function using subroutines for Multiplication and Factorial. Multiply subroutine should take into account sign values. The overall program structure should be as follows:

RESET mov.w #__STACK_END,SP ; Initialize stack pointer

StopWDT mov.w #WDTPW+WDTHOLD,&WDTCTL ; Stop WDT

LAB2 mov.w #5,R4 ; Load "a" into R4

CLEAR clr R5 ; clear the entire register

clr R6 ; clear the entire register

clr R7 ; clear the entire register

XCALC ... ... ; the X calculation part of your program

... ... ; taking value of R4 as an input

... ... ; and returning result (X) in R5

FCALC ... ... ; the final part of your program

... ... ; taking inputs from R5 and R6

... ... ; and returning result (F) in R7

MainLoop jmp Mainloop ; Infinite Loop

;Subroutines have to be implemented after MainLoop

;Multiply Subroutine must be develop taking into ;account negative values

;**Negative Value can be given as input and program should still

; execute correctly.

** **Subroutines must take into account all possible cases**

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

SQL Antipatterns Avoiding The Pitfalls Of Database Programming

Authors: Bill Karwin

1st Edition

1680508989, 978-1680508987

More Books

Students also viewed these Databases questions