Question: Lab 4 . 1 . 1 : For / While Loops and Arrays Write a program that will output the sequence shown below to the

Lab 4.1.1: For/While Loops and Arrays
Write a program that will output the sequence shown below to the LEDs. Remember to initialize all of the pins of Port S (at address $248) as an output by setting all of the bits of the DDR of Port S (at address $24A).
Sequence -$81,$42,$24,$18,$24,$42
The program should continuously loop through the six values above, outputting each value of the sequence one at a time on the LEDs. When the end of the sequence is reached, the program should start over at the beginning of the sequence.
Load the effective address of the sequence to Index Register x so that x points to the first value of the Sequence. Use post-auto increment addressing to cycle through each element of the sequence. Either use a terminator at the end of the list (while loop) or a counter to count to the end of the list (for loop).
To debug, step through the program. When running the program at speed, all the lights will appear to be on (one clock cycle is 0.25S, so the MCU will execute the instructions so fast that all of the LEDs will appear as if they are always on).
 Lab 4.1.1: For/While Loops and Arrays Write a program that will

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!