I was definitely the most worried about this week's assignment, so while it doesn't seem like I accomplished that much, I am proud of my progress. I started off the week by reading the first 3 chapters of the Make book, which really explains microcontrollers from a very basic perspective. That was really helpful in giving me the basic vocabulary to understand the data sheet for the microcontroller. Whew! That took quite a while to read, given that I still needed to stop and look up other terminology to better understand how it all works. Once I finished all the reading, I was off to the lab to get some programming done! Or so I thought...
When I plugged the programmer and my PCB board in, I was sadly greeted with error messages, where my computer didn't read the chip at all. So, it was back to the drawing board. With TA Tiffany Cheng's help, we were able to locate a few problems: The header was not connected to the attiny, and the milling job was not cleanly done, so the two pins on the lower left were actually connected together. I tried valiantly to fix the mistakes by sautering wires, but no luck! I then found out that there were problems with the way the ground line was traced around the board.
So, I went back to GIMP, and decided it would be faster to draw the traces correctly through GIMP than redo the whole board through Eagle. Once I remilled the board, I was extra careful to sauter the components accurately, as I definitely didn't want to make a 3rd board!
This time, despite my careful sautering, the ground trace was so thin that sauter connected it to the pin on one of the headers. I used the heat gun for the first time and removed the chip and then used an Xacto knife to carve a trough to separate the traces. Whew - that worked!
This was the code I used:
#include #define F_CPU 1e6
#include #define TRUE 1
#define FALSE 0
int main()
{
//SETUP
//Button is on PA3
//LED is PA7
PORTA= _BV(PA3); //Turn button pullup resistor on
DDRA = _BV(PA7); //Enable output on the LED pin
PORTA = _BV(PA7); //Turns LED on
//LOOP
while (TRUE)
{
if ((PINA & _BV(PA3))) //button is not pushed
{
PORTA = 0; //turn LED off
}
else
{
PORTA = _BV(PA7); //turn LED on
_delay_ms(1000);
PORTA = 0;
_delay_ms(1000);
}
}
}