Answer the following questions based on the program given un

Answer the following questions based on the program given:

unsigned int inVal, out, k=0x0001, m=0x8000;

unsigned char index=0xFF; . . .

while (k > 0)

{

inVal = (m + k)/k;

out = someFunction(inVal);

m /= 2; k <<= 1; } . . .

How many times would each of the following loops actually iterate on the MSP430F5529?

What are the values of k, m and inVal (in decimal) at the start and end of the first loop?

What are the values of k, m and inVal (in decimal) at the start and end of the final loop?

Solution

By the given program 3 times it will iterate on the MSP430F5529

and by solving the program we will be getting the k,m values as follows

which will be in the decimals only

k=-1,m=0 which will be at the start and end of the first loop

and k=1,m=2 are the values at the end of the loop.

Answer the following questions based on the program given: unsigned int inVal, out, k=0x0001, m=0x8000; unsigned char index=0xFF; . . . while (k > 0) { inVal

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site