2. Open AVR Studio 4
3. New Project. Select AVR GCC for the project type. Enter the project name and initial file name. In the screenshot below, we named our project “BlinkLED” and elected to have a folder called “C:\BlinkLED” created containing the blank file “BlinkLED.c”. Click Next >>. DO NOT click “Finish” yet. If you do accidentally click “Finish”, you will not be able to perform step 2 and will instead have to set the device by going to the “Project” menu and selecting “Configuration Options”.
4. Select AVR Simulator as the debug platform and then select the appropriate device for your target AVR. For an Orangutan or 3pi Robot, this will either be ATmega48, ATmega168, or ATmega328P depending on which chip your Orangutan or 3pi Robot has. Click Finish.
5. Write your program in BlinkLED.c as seen in the screen shot below and click the Build button on the toolbar (or press F7).
6. Make sure your USB AVR programmer is connected to your computer via its USB A to mini-B cable and then click the Display the ‘Connect’ Dialog button on the toolbar. You can also accomplish this by going to the “Tools” menu and selecting Program AVR > Connect….
7. This will bring up a programmer selection dialog. Select AVRISP as the platform. The USB AVR programmer uses AVR ISP version 2, which is written as AVRISPv2. Please note that this is not the same as AVR ISP mkII. Select the port name of your programmer if you know what it is, or select Auto and AVR Studio will try all the ports until it detects the programmer. You can determine your programmer’s port name by looking in the “Ports (COM & LPT)” list of your Device Manager for “Pololu USB AVR Programmer Programming Port”. Click “Connect…” to bring up the ISP window.
8. Select the Main tab. In the dropdown box that lists AVR models, select the same device that you selected when you created the project. For an Orangutan or 3pi Robot, this will either be ATmega48, ATmega168, or ATmega328P.
9. If you have not done so already, connect the programmer to the target device using the 6-pin ISP cable. Make sure the cable is oriented so that pin 1 on the connector lines up with pin 1 on your target device! You can test the connection by going to the Main tab and clicking the Read Signature button. This sends a command to the target AVR asking for its device signature. If everything works correctly, you should see “Signature matches selected device”. If the signature does not match the selected device, you probably have the wrong device selected (or possibly your target device is turned off). If reading the signature fails entirely, please see Troubleshooting (Section 7) for help getting your connection working.
10. Now it is time to program your target device. Select the Program tab. Your Input HEX File in the Flash section needs to be the hex file that was generated when you built your program. You can browse for this using the "..." button to the right of the input file text box. If you navigate to your project’s folder, you should find it as “default\
11. As your USB AVR programmer programs the AVR, you should see all three LEDs flicker and you should see the following text appear at the bottom of the window:
Reading FLASH input file.. OK
Setting mode and device parameters.. OK!
Entering programming mode.. OK!
Erasing device.. OK!
Programming FLASH .. OK!
Reading FLASH .. OK!
FLASH contents is equal to file.. OK
Leaving programming mode.. OK!
If there were no problems, the LED connected to PD1 of your AVR should now be flashing! Note that if you are trying this on a 3pi robot and you have not yet soldered in the optional through-hole LEDs, the flashing LED will be on the bottom of the robot. If there was a problem, please see Troubleshooting (Section 7) for help identifying and fixing it.
12. Your Robot is ready to use with your program!
AVR Programmer ႏွင္႔ Pololu Robot အေၾကာင္းအား http://www.meepyatite.info/2011/07/pololu-3pi-robot.html တြင္ ေလ႔လာနုိင္သည္။