Badge design - step 2


Finished writing the code for the badge; nothing fancy - just 4 red LED's and a switch. The muC goes to power down mode after executing some initialization routines - the current consumption is less than 1uA in this mode. The switch connected to PB4, when pressed, will result in a pin change interrupt which wakes up the processor - it then performs the first of 4 actions - a simple `running' LED's - and goes to sleep. Another switch press again wakes up the processor and it performs the second `action' (generates terms of a famous number series). The third and fourth actions are - generate a pseudo-random bit stream using a linear feedback shift register and generate an LED `dim-bright' effect using the hardware PWM module. Total amount of code space consumed = 159 words (total available is 512). The code uses only registers simply because the processor doesn't have any RAM! I now like the avr instruction set very much. It's time now to wrestle with GEDA and have the pcb ready ... that's the difficult part. Will let the code `sleep' for the whole of tonight - let's see how much of a drain it causes on the 3V button cell...

[Subscribe to our Newsletter] [Go to home] [Courses at Recursive Labs] [Connect with me on Twitter/Facebook]