Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

4. (25 points) Design and write an MSP430 assembly language subroutine that returns the maximum absolute value of a signed integer array, ie, MAXABS-maximum(/a(i)/), i=0,

image text in transcribed

4. (25 points) Design and write an MSP430 assembly language subroutine that returns the maximum absolute value of a signed integer array, ie, MAXABS-maximum(/a(i)/), i=0, n-1, n>0. The main program that calls the subroutine is shown below. What does the main program do with the returned value? How do we pass the input parameters? #-STACK-END,SP RESET StopWDT mov.w ; Initialize stackpointer mov .w #WDTPWIWDTHOLD,&WDTCTL ; Stop watchdog timer main: bis . b #0xFF,8P1DIR bis.b #0xFF,8P2DIR push #arri mov . w #aend, R5 sub .w #arri, R5 rra.W R5 push R5 call #maxabs add.w #4, SP mov.b R12, P1OUT swpb R12 mov.b R12, P2OUT jmp$ ; configure P1.x as output ; configure P2.x as output push the address of arrl ; the next address ; (#aend- #arr1)/2 is the number of elements push the number of elements on the stack .int 1, 2, 3, 4, -5, 9, 12, 11 ; signed array arr1: aend: maxabs: write your code here 4. (25 points) Design and write an MSP430 assembly language subroutine that returns the maximum absolute value of a signed integer array, ie, MAXABS-maximum(/a(i)/), i=0, n-1, n>0. The main program that calls the subroutine is shown below. What does the main program do with the returned value? How do we pass the input parameters? #-STACK-END,SP RESET StopWDT mov.w ; Initialize stackpointer mov .w #WDTPWIWDTHOLD,&WDTCTL ; Stop watchdog timer main: bis . b #0xFF,8P1DIR bis.b #0xFF,8P2DIR push #arri mov . w #aend, R5 sub .w #arri, R5 rra.W R5 push R5 call #maxabs add.w #4, SP mov.b R12, P1OUT swpb R12 mov.b R12, P2OUT jmp$ ; configure P1.x as output ; configure P2.x as output push the address of arrl ; the next address ; (#aend- #arr1)/2 is the number of elements push the number of elements on the stack .int 1, 2, 3, 4, -5, 9, 12, 11 ; signed array arr1: aend: maxabs: write your code here

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

Build It For The Real World A Database Workbook

Authors: Wilson, Susan, Hoferek, Mary J.

1st Edition

0073197599, 9780073197593

More Books

Students also viewed these Databases questions

Question

Differentiate 3sin(9x+2x)

Answered: 1 week ago

Question

Compute the derivative f(x)=(x-a)(x-b)

Answered: 1 week ago