Question: Write AVR assembly code to solve the equation as described below. You will store the computed results into data memory. All math will be performed

Write AVR assembly code to solve the equation as described below. You will store the computed results into data memory. All math will be performed using integers. No floating point operations are required.

Calculate the velocity of an artificial satellite orbiting an object in space. Your answer must be in units of kilometers per second.

You will be provided the radius of the orbit () and the standard gravitational parameter (GM) corresponding to a particular planet. Round your answer at all stages of the equation. For example, should be rounded to the nearest integer when performing division. If the square root of is not already an integer, round it downward.

Math Example

Please look at the template file as you read through this example. Suppose that the source code file indicates that we have an OrbitalRadius of 0x64, 0x19. Assume that it also specifies SelectedPlanet as 0x02. Since the values are stored in little-endian format, the OrbitalRadius has a decimal value of 6500. With a SelectedPlanet value of 2, this is indicating that we need to use the GM value that is located at index 2 of the array (explained within the template file). Based on the example file, this corresponds to the hexadecimal data 0x08, 0x15, 0x06, 0x00. Interpreting this as an unsigned 32 bit value in little-endian format, it's equivalent to the decimal value 398,600.

We now compute When you perform division, you will round to the nearest integer. That's why we rounded to 61 even though 61.3230 is a closer approximation. You need to store this value into memory at address "Quotient". This allows us to evaluate your code for partial credit. When the grader inspects the Quotient in data memory (using Atmel Studio) they will see the 24 bit representation in little-endian format:

0x3d, 0x00, 0x00

Next, we need to compute the square root: (note that we round down for square roots)

Our final answer is 7 km/s. The value 7 should be stored into the "Velocity" location as a 24 bit representation:

0x07, 0x00, 0x00

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!