©2019 Robotics for COMPLETE Beginners

12

Installing Software

 

Alright! Time to set your computer up to be able to write and flash programs to your AVR chip!

This lesson will be both easy and confusing so pay attention!

In order to understand how this will work you need to know how the computer will be able to program your chips.

The basic process is called the toolchain and is simplified as follows:

This is very simple.

1. You can write C code in ANY text editor, really. But it is best to use one that can show errors while you type, etc. The easiest and lightest is something like Notepad but we will use Programmer's Notepad for reasons I will list below.

2. You then use a code compiler that you need to install on your computer to translate the C code into machine code. We use the C language because it is understandable for us but the computer needs that translated down into Hex format which is like 10010101101011101011.

3.  You then use AVRdude which needs to also be installed to flash that hex file through your USB programmer which is connected to your AVR chip!

Reread these steps. It's VERY simple.

The good news is, we can install all of these things (Programmer's Notepad, AVR-GCC compiler, and AVRdude) all with one download file!

I am a Windows user. I don't love Windows, I am just familiar with it since I was very young. I used to use DOS before that when I was like 5 so I won't be here to listen to any Mac user complaints. I am not sorry about that. It is what it is. From here on I will be referring on how to use the Windows AVR setup.

HOWEVER!

Because I am so nice I have included the download files for BOTH the Windows and Mac programs you will need below.  The Mac equivalent has very clear and short instructions as well as the tools you will need so don't panic. I never used Linux and don't care. I respect it. I just never had to use it. Luckily installing on Linux is VERY quick and easy. Many people have shown how to do it. C'mon I can only hold 2 hands at a time people.

The WinAVR download has instructions on the site that are still relevant. PLEASE pay attention and everything will work well. If not, just uninstall and reboot and try again. Go SLOW. If you have a problem there are millions of Google answers for you, I have already searched a few times so don't worry.

Both Windows and Mac files are listed below and the instructions are clear.

Make sure you ALLOW WinAVR to change your PATH variable so you don't have to type in all of the pathnames of all of your files to get it to work. Just, trust me. If you don't do it nothing will work.

I saw one complaint that it messed up someone's PATH variables for EVERYTHING on their computer. This was the only guy though. I have installed this file several times on several computers after having several drinks.

I only had one time where I messed something up and just uninstalled and reinstalled no problem.

For all users, I recommend installing AVRDUDESS. It works with Windows, Mac OS, Linux and Ubuntu.

You NEED this! Trust me. It will save you so much time.

This is a graphical interface which lets you skip programming with the console (aka terminal for Mac users).

It is wonderful! It is similar to the Arduino drop down menus and lets you program in a few clicks.

It is the best, get it here now!

I mentioned I recommend Programmer's Notepad ++ for Windows users.

It is light, can create the Makefile you will need with the click of a button and shows your errors when attempting to compile.

If not installed with the WinAVR package, get it.

Also, the reason it isn't available on Mac OS is because it relies heavily on the Win32 API.

HOWEVER!

There are ways to still make it work on Mac OS and even some great alternatives! YAY!

Check all of your Mac options here.

Finally, you CAN use the Arduino compiler that is available on their website and still program it in C.

ONLY if you are using an Arduino board with the AVR chip on it.

I started programming in C language this way but soon ran into weird problems with the timing of the AVR chip because the Arduino board has a built in crystal oscillator which allows for faster frequencies.

That's when I decided to ditch my Arduino, roll up my sleeves, grow out my beard to 3 cm and go the barebones chip route.

Get my favorite books on programming AVR chips I use.

Equip yourself with the most dependable, no hassle, quality usb programmer I use daily.

Make sure you have a basic kit. Arduino is fine, it contains the removable AVR 328p chip we will use.

 

I started with something very similar.

Summary

This was a short but very important tutorial on how to set up the software needed for programming your microcontrollers.

We will be using the AVR chips, specifically the 328P which is the same chip found on the Arduino Uno boards.

Although some protocols and wording may be different, these concepts can be applied to different brands of chips like the PIC series.

Like I mentioned before, sometimes there are bumps in the road when setting up ANY kind of software, even games right? So, Google is your friend. Remember, to take it slow, and try to understand what went wrong.

You will get it.

In the next lesson we will cover the USB programmers which you can use and the one I recommend and why.

We will also look at how to hook it up to the AVR chip properly.

See you there!