Week 8: Embedded Programming

Assignment: Read the data sheet! Program a microcontroller to do something in as many languages in as many programming environments as possible.

1. Arduino programming environment: David Meliss tutorial.

I followed David Meliss's tutorial on using the Arduino development environent and language to program the ATtiny44 chip using the FabISP board. The tutorial is detailed, and I was almost successful at programming without help. Charles Fracchia helped me get there. Here are the extra things that I needed to know to get it to work, and a few other useful things.

Below I show some oscilloscope traces of the signal from the LED pin, pin 8 in Arduino speak. The microcontroller is running the blink program. The scope probe is poking into the solder ball at the top of the LED current limit resistor, and is referenced to the board ground.

First, using a delay of 1 ms. The command is: delay(del); where del=1 The High and Low times are both 1.08 ms. (Setting the delay to 2 gives 2.15 ms).

Next, use a delay value of zero, which gives an 8 microsecond time for high and low (with sometimes a 12 microsecond duration)

Now, eliminating the delay statement entirely, just letting the program loop between high and low, gives duration of 3.8 μs high and 4.1 μs low, with occasionally (maybe 1 out of 100) a duration of 8.5 μs, either high or low.

Check the clock period with the scope: For 30 periods (only three shown below) I measure 1500 ns. This is 20 MHz to within less than a percent.

Below is a picture of the blinking thing, and on the right another output device. At blink frequencies abouve 100 hz or so the speaker is audible when connected in series with the 500 Ohm resistor (ie in parallel with the LED). When briefly attached directly to the pin, it is louder, and the micro is not damaged (not destroyed) by the near short to its output pin.

So far, I have seen that with the Arduino code I have used:

2. Programming using shell commands on Mac OSX.

Charles Holbrow has put together a very clear tutorial on programming using command line utilities on the Mac OSX. This method uses the more standard AVR C libraries, the gcc compiler, and the avrdude programming software. Other potentially useful related links:

I ran into problems as I started using the make commands. Need to back up and try again soon. Much more to do here, but something of a start was accomplished this week.

3. Class notes Nov. 30