Question: 2 . There is to be an array VALUES of 1 6 unsigned 8 - bit numbers in the range 0 - 1 5 .

2. There is to be an array VALUES of 16 unsigned 8-bit numbers in the range 0-15. Display these in a
Memory View using the Hex rendering (to see hex bytes). Use the following values, in this order:
0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x00,0x0F,0x0E,0x0D,0x0C,0x0B,0x0A
3. There are to be six global variables in data memory: PHASE, MINS, MAXS, MINU, MAXU, AVGU.
These are to be displayed in the Live Expressions View. Use Hex format.
4. Variable PHASE is to be a counter that increments from 0 to 4(it will not repeat.) Each press
of the User Button is to interrupt the program to increment the value of PHASE. (That is the only
function to be performed in response to the button interrupt.)
5. The program is to perform a series of five tasks. Each task is to be a subroutine, called from the main
program. Following initialization of devices and global variables and turning off all LEDs, the main
program should contain only the five task subroutine calls, followed by a Here: b Here instruction
at the end to effectively stop the program after completing the five tasks.
6. Remain in each task subroutine until the value of PHASE changes. Then return to the main loop to
call the subroutine for the next task.
7. The tasks are to be performed are as follows.
Task0(PHASE =0): In this subroutine:
Execute a continuous while loop that checks PHASE and returns when PHASE is no longer 0.
Task1(PHASE =1): In this subroutine:
a) Configure the timer so that timer interrupts produce the LED pattern from Step 2 of
Homework 27. This pattern is to continue until the next task begins.
b) Treating NUMBERS as an array of signed integers, find the minimum (most negative) value
and the maximum (most positive) value in the array. Store these in variables MINS and
MAXS, respectively.
c) Execute a while loop to check PHASE and return with it is no longer 1.
Task2(PHASE =2):
a) Configure the timer so that timer interrupts produce the blue and orange LED pattern from
Homework 28. This pattern is to continue until the next task begins.
b) Treating NUMBERS as an array of unsigned integers, find the minimum value and the
maximum value in the array. Store these in variables MINU and MAXU, respectively.
c) Execute a while loop to check PHASE and return with it is no longer 2.
Task3(PHASE =3):
a) Configure the timer so that the timer interrupt handler will read bytes from array VALUES
and display them on the LEDs. The 4-bit number represented by bits 3-0 of the byte are to
be displayed on the Blue-Red-Orange-Green LEDs (pins PD15-PD12). For example, if the
value to be displayed is 6(2_00000110) then Blue would be off, Red and Orange would be
on, and Green would be off. Each bytes LED representation should display for one half
second before changing to the next byte in the array. Stop changing the LEDs after the final
value of the array has been displayed, leaving that value on the LEDs until the next task.
b) Treating NUMBERS as an array of unsigned integers, find the average of the 20 values and
store this in variable AVGU.
c) Execute a while loop to check PHASE and return with it is no longer 3.
Task4(PHASE =4):
Disable timer and button interrupts, turn all LEDs ON, and return to the main progra

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 Programming Questions!