Need help with assembly language code for microcontroller


#1

Could someone help me with an assembly code program for the MSP430G2553 that satisfies the following conditions:

You are given an array of 16-bit numbers of which you will determine the median. The numbers should be stored in an array called “Array1” at the beginning of RAM. When the program has finished running, the median will be stored in RAM under the variable name “Median”. End the code with a loop to prevent random execution after the program has finished.

Array1 = [ -13, 4, 0, 7, 66, -200, 400, 3, 87]

*Note: Put these into RAM in exactly this order to start, do not pre-arrange your numbers. However, you may choose to overwrite the Array1 in your program or assign a new array.

Median should be stored as a 16-bit number in RAM with variable name “Median”

To calculate a median: (1) put the numbers in numerical order, (2) determine which is in the middle of the set. It is up to you how you should best utilize you’re the memory (RAM, STACK, etc.), particularly in how you re-order your array before finding the middle number.