CSC231 Homework 8

From dftwiki3
Revision as of 07:45, 7 November 2008 by Thiebaut (talk | contribs) (Submission)
Jump to: navigation, search

(c) --DT 13:42, 30 October 2008 (UTC)

The deadline for this assignment is Fri. Nov 14th, at 11:59 p.m. plus 1 minute.

Reading Files

Write an assembly language program that is compatible with the arduino-serial.c program of Lab 7 and which reads a file of commands and sends them to the Arduino.

The file will be called "arduino.cmd", always, so no need to ask the user for it: you can hard code this string in your program.

The commands supported will be of the form:

  • w d p n or w a p nnn where n is either 0 or 1, nnn is an integer, and p is a pin number.
  • r d

So, a command file could be something like this:

w d 2 0
w d 3 0
w d 4 0
w d 5 0
w d 6 0
w d 7 0
w d 8 0
w d 2 1
w d 3 1
w d 4 1
w d 5 1
w d 6 1
w d 7 1
w d 8 1
w d 8 0
w d 7 0
w d 6 0
w d 5 0
w d 4 0
w d 3 0
w d 2 0

which will clear Pins 2 to 8 then turn 2, 3, 4, ... 8 ON, one after the other, then turn them off in the reverse order. You could imagine having a huge file with thousands of lines for creating an interesting light show!

Your program will read one line of the file at a time, will copy it in the buf buffer of the C program, and will call the function to send a string to the Arduino...

Submission

Save your program in a file called hw8.asm, and submit it along with arduino-serial.c as follows:

submit hw8 hw8.asm
submit hw8 arduino-serial.c

Testing

Because the Arduino contains an LED on Pin 13 already, you do not need additional hardware to test your program. Create a file with multiple "w d 13 0" and "w d 13 1" strings, and that should be enough to test your program. For debugging purposes you may force the assembly to wait a few milliseconds between strings, so that you can see the result of the execution.

Limitations

For this assignment, I would ask you not to modify the arduino_loop.pde sketch. You will be free to modify the sketch for your final project, but not for this assignment.

Resources

Make sure you read the information posted in the weekly-schedule page for the week of 11/03.

You may find the solution assembly program for Lab 7 useful...