Tuesday, November 25, 2008

Dumb ATmega8 project

Finally finished the ATmega8 library.  Has API to use a 7-segment LED, pins, PWM, 2-bit flip flop, timers and some other random stuff.  The code size is pretty big though.  Not sure how to optimise the size away without losing the abstraction.  So for the final Alkali programme, it's able to detect light pulses with a reverse biased LED.  Depending on the length of the pulse, it will generate one of three events.  These three events will be "reacted" on by setting the speed of the fan and writing one data bit to the 2-bit flip flop.  The fan has three speeds; maximum, medium and off.  There's an LED that blinks on and off at close to 1 second intervals.  There is an LED that indicates the persistence of a light pulse and its indication will also persist.  The output of the tachometer of the fan is connected to a couple of external interrupt pins and these are used to turn the decimal point of the 7-segment LED on and off.

So yeah, a pretty dumb project . . .

No comments: