AVR BASIC HOOKUP
BASIC POWER HOOKUPS:
Figure 1: AVR Power Pins (Same on ATmega8/88/168/328)
The AVR is not difficult to hook up. All you really need is to hook power up to 4 pins and the AVR is ready to run. While VCC and GND are obvious you might be asking yourself about AVCC. The answer like most is in the datasheet (page 5 or so under "Pin Description") which states:
"AVCC is the supply voltage pin for the A/D Converter, Port C (3..0), and ADC (7..6). It should be externally connected to VCC, even if the ADC is not used. If the ADC is used, it should be connected to VCC through a low-pass filter"
The part about that low-pass filter might have you confused, it basically a capacitor, C1 in figure 2. So while C1 is not really needed it you can see that it is recommended in the event that you decide to use the ADC.
If you are using the Arduino you simply have to plug a 7-12V power adapter into it and your ready to roll. If however you are using just the AVR chip itself you need to provide the chip with a 2.7-5.5V DC voltage source. The 2 most common voltages are 3.3V and 5V.
Figure 2: Basic AVR Power Hookup
The best way to get a stable 3.3V or 5V voltage is to use a Voltage Regulator. This is a component that basically takes a voltage source of 7-12V and converts it down to 5V (or 3.3V) for you. You will need to use 2 small capacitors (0.01pf) in order to stabilize the voltage regulator, but I'll cover that in a later tutorial.
Figure 3: Basic AVR
Figure 3 shows the basic power wires. Red wires are Vcc, Green wires are GND, and the black wire is the source (+) of the battery.
Now that we have the power hooked up we could get the chip to actually do something. However, before we do that we need to figure out how to get power into the AVR
ISP HOOKUP:
Figure 4: AVR ISP Pins (Same on ATmega8/88/168/328)
The ISP (In System Programmer) Port lets us do this. However, you will need some sort of programmer in order to interface between your PC and the AVR.
If you have an Arduino you will not need to the ISP port because it is already programmed with a program called a bootloader which allows it to be programmed via the serial using the USB wire.
But if you decide to use the raw AVR itself you will need to use the ISP. One important thing to tell is that the ISP port can provides power to the chip, therefore it is important to unhook the power supply from the AVR before you try to program it. The second thing to note is that most programmers are setup for a 5V Vcc by default but, if your micro is setup on any other voltage you will have to configure your programmer for that voltage.There are many programmers out there so read your manual. Last thing you want is to put a 5V signal into a 3.3V circuit and see the mystic blue smoke.
The ISP port can be found in 2 configurations, a 6 pin and a 10 pin and they are setup as follows:
Figure 5: 6 pin ISP
The 6 pin ISP is the most commonly used ISP header, but the 10 pin still exists so lets go over it shall we?
Figure 6: 10 pin ISP
Notice the N/C (not connected) line in the 10 pin ISP? Well some sites will tell you to connect this to GND, this is a BAD BAD BAD idea. This pin is actually used by some programmers for alternate functionality (such as pulsing an LED). So leaving this pin not connected will make your project more universally friendly.
One very important thing to note is that connecting some loads to the ISP pins can cause problems, a few years ago I connected a pizo buzzer between MISO and MOSI and it caused connection faults. Since then I put a jumper on each line (so that I could disconnect the loads by removing the jumper) as shown in Figure 7.
Figure 7: Jumpers on the ISP lines
Hope that helps. Back to Killzone 3 multiplayer for me.
Cheers
Q