Set up Your Arduino C Programming Environment
|Read Make: AVR Programming.||
Pay special attention to setting up your PATH environment variable. You can access it via:
- right-click on This PC, choose Properties
- click Advanced System Settings, choose Advanced tab then Environment Variables
- click variable Path and then the Edit button if necessary to record your environment BEFORE installing the WinAVR toolchain. I didn't and subsequently some apps normally found in c:\windows\system32 were inaccessible unless I changed to that folder and ran them from there. The better fix was to add c:\windows\system32 back into the path and place it at the top.
As an example, here is my final Path setup:
|Download WinAVR toolchain for Make: AVR Programming.||https://sourceforge.net/projects/winavr/files/WinAVR/20100110/||
The toolchain download also includes a great code editor (Programmer's Notepad), and AVRDUDE for programming your ATmega328P microcontroller.
I installed the toolchain in D:\WinAVR-20100110.
I then deposited the book's files into D:\AVR-Programming-master.
I wrote a tiny batch file called avr.bat in my home directory (C:\users\<yourname>) that simply changes directory to whatever folder I am currently working in. Example:
In this folder, d:\avr-programming-master\Chapter05_Serial-IO\serialOrgan, I "<CTRL> dragged" the Makefile so that it made a backup called Makefile-Copy. I then replaced the first 26 lines of Makefile with that of Make_Chunk.txt. You'll need to change the COM port in yours, though.
With all of this out of the way, you can now simply run the following at the command line prompt:
This will compile serialOrgan.c into the serialOrgan.hex file that AVRDUDE will download to the ATmega328P to Flash it. The program will run automatically once the download is complete.
|Download project code for book Make: AVR Programming.||https://github.com/hexagon5un/AVR-Programming||
Click on the green CODE button, then choose Download ZIP.
Read the README.md file.