# How To Program Your Micro-Controller This is about using `avr-dude`, `make` and getting a high-level understanding of what's happening under the hood so that you can tune your micro-controller yourself. In practice, you can just read most of what is linked in the **Embedded Programming** class [there](http://academy.cba.mit.edu/classes/embedded_programming/index.html). In fact, you should have done that already. But for those who are overwhelmed, we will try to disect some of the content ## References * [HTMAA's Embedding Programming](http://academy.cba.mit.edu/classes/embedded_programming/index.html) * [Makefiles](https://makefiletutorial.com/) for executing pre-written commands * [avrdude](https://www.ladyada.net/learn/avr/avrdude.html) (by Lady Ada) for programming through a programmer * Existing tutorials for various programmers: * [Sparkfun's avr programmer](https://learn.sparkfun.com/tutorials/pocket-avr-programmer-hookup-guide/al) * [AdaFruit's USBTinyISP](https://learn.adafruit.com/usbtinyisp/avrdude) * [List of AVR IC's and their packages](https://en.wikipedia.org/wiki/ATtiny_microcontroller_comparison_chart) * [ATtiny10](http://www.digikey.com/product-detail/en/ATTINY10-TS8R/ATTINY10-TS8RCT-ND) * [ATtiny45V](http://www.digikey.com/product-detail/en/ATTINY45V-10SU/ATTINY45V-10SU-ND) * [ATtiny44A](http://www.digikey.com/product-detail/en/ATTINY44A-SSU/ATTINY44A-SSU-ND) * [ATtiny814](http://ww1.microchip.com/downloads/en/DeviceDoc/Atmel-42721C-AVR-ATtiny417-814-816-817-Datasheet_Complete.pdf) * [ATmega328P](http://www.digikey.com/product-detail/en/ATMEGA328P-AU/ATMEGA328P-AU-ND) (same as [Arduino Uno](https://en.wikipedia.org/wiki/Arduino_Uno)), ([datasheet](http://ww1.microchip.com/downloads/en/DeviceDoc/Atmel-7810-Automotive-Microcontrollers-ATmega328P_Datasheet.pdf)) * [ATmega16U2](http://www.digikey.com/product-detail/en/ATMEGA16U2-AU/ATMEGA16U2-AU-ND) (with 16**U* for USB support) * [ATxmega16E5](http://www.digikey.com/product-detail/en/ATXMEGA16E5-AUR/ATXMEGA16E5-AURCT-ND) * [ATxmega16A4U](http://www.digikey.com/product-detail/en/ATXMEGA16A4U-AUR/ATXMEGA16A4U-AURCT-ND) (USB support) ## What are those files? For most base projects of HTMAA, you are provided with a set of different files: * `file.png` are typically images for tracing (trace) or cutting (outline) * `file.c` is a C file that contains a C program, which runs on a micro-controller * `file.make` (or anything ending in `.make`, so here typically `file.c.make` too) is to use the program `make` to call commands that allow you to do things ## What does `XXX` do? First thing first, you should try reading the manual. On Mac / Linux, you can access the manual of a specific command typically by typing ```bash man fancycommand ``` For example, we want to learn about `make`, so let's do that: ```bash man make ``` That should give you an interactive stream that you can go over (down/up arrows) and search through (`/` character, followed by search query). <img src="images/man_make.png" width="800"> To exit that manual, just press `q` (quit). To get some help and figure out how to use the manual functions, press `h` (help). <img src="images/man_help.png" width="600"> ## What is [Make](https://www.gnu.org/software/make/manual/html_node/Introduction.html#Introduction) References: * [Make manual](https://www.gnu.org/software/make/manual/make.html)