Objectives
Learn to read a microcontroller data sheet.
Utilize common programming protocols.
Reading a data sheet.
Reading the
data sheet
takes a lot of time. But once you are done it becomes a more useful reference.
Things to remember:
1.)Write code that gives instructions.
2.)Compile the code to get the binary.(That will most likely be a .hex file.)
3.)Transfer the binary to the chip.
4.)Here is the problem. To program the chip, you need a programmer.
To program the programmer, you need a programmer!(chicken-egg problem)
No problem since you can buy a programmer or use a commercial Arduino.
Starting with a code sample:
Simple Blink
Comment:>Blinking Led seems like the perfect start. I am using Cross Pack and command line tools.
Process:
Change the file directory.
Type avr-project [Project Name]
Enter the new directory. Open the main.c file. Edit.
Commands: make , make flash, make fuse
Seems Simple
Flashing the FabISP was easy after correcting many errors.
There is a lot of checking of connections especially between the ISP header pin and the board. I have
had that problem several times.
When I get an error most of the time it is because of a bad connection on the board. There are only 6 things
that have to worked out for the programming piece.(MISO,MOSI,VCC,GND,RST,SCK). Each path that goes between
the header and those pins should be double checked.
The second part of the week assignment was to experiment with various platforms.
Update:
Throught the class I used 1/2 Arduino IDE and 1/2 C.
To use these you either download from Arduino.cc or for the C-code on a MAC you
download the command line tools CrossPack.
An example of each can be found:
Hello Button was programmed/documented in Week 11 using Arduino IDE
Hall Sensor was programmed in Week 11 using C-code.
I still struggle reading and editing the C-Code. More to come on this.