HW6: AVR Assembly Language Blink¶
This homework is another simple AVR assembly language exercise.
Note
Be sure you have set up your VM properly for building AVR projects. You will not be able to do this assignment until ll of that setup works properly!
Blinking the LED¶
In this homework, we will complete the work we began when we introduced the AVR assembly language system. In that lecture, we did not finish the outer loop needed to make the LED blink at a rate our eyes can follow.
For this exercise, all you need to do is get the LED blinking on and off at a rate approximately equal to one half second. This needs to be done in a subroutine,
The basic idea is in the delay.S
code. We are using a simple loop that does
nothing but count down a variable to stall the machine. If one loop does not
stall it long enough the obvious next idea is to put a second loop inside of
the first loop. If that one is not sufficient, we can add yet another loop
inside of that one. Doing that in C++ would not cause you any heartache. Doing
it in assembly language is not much harder. You need new labels, and a
different register for each counter variable. Look at the example code and you
should be able to figure this out!
Blink in a Pattern¶
The actual final product of this exercise will have the LED blinking in a defined pattern.
The timing of this sequence looks like this:
ON for 1/2 second
OFF for 1/2 second
ON for 1/2 second
Off for one full second
Repeat this sequence.
Writing the Code¶
Most of the code needed for this project is in the lecture notes. Set up the
project in a single directory, with the Makefile
provided earlier. Your
code should compile cleanly using the Makefile
. You will generate a “hex”
file that you can load into the Arduino boards I bring to class.
If you have problems getting your VM set up for this, and communicating with the Arduino see me during the lab time to work this problem out.
Place this work in a HW6 folder under the homework
folder in your class
project repository.