Hi AVR freaks, and thanks for being here as I embark on my AVR journey!
I just compiled and ran my first blinky light project for the ATMEGA328P (code below). The code isn't particularly interesting, but I thought people might be interested that I used my TL866A to program the chip, and how I did that, so I wrote up a little mini HOWTO.
The programmer is this one: http://www.autoelectric.cn/en/tl...
I bought it from a monopolistic online retailer, installed the software from the website, and it works great. The English is a little clunky, but not too hard to follow.
To flash a program I followed these steps (see image of the MiniPRO application, sorry for the amateurishness):
- Typed my program in AVR studio
- Compiled with ATMEGA328P as my device target
- Put my chip in the MiniPRO ZIF socket
- Plugged in the MiniPRO to my laptop
- Ran the MiniPRO desktop application
- Opened the hex file generated by the compile step. In my case it was: "C:\Users\YOURUSERNAMEHERE\Documents\Atmel Studio\7.0\simpleBlinky\simpleBlinky\Debug\simpleBlinky.hex"
- Once it had loaded into the MiniPRO application, selected the chip from the "Select IC" dropdown
- Then flashed it using the program button with the big "P" in the upper right.
I was then able to give it 5V of power with a LM7805 on a breadboard and drive an LED connected in series with a 1K resistor (sorry for the lack of schematic, you can probably all figure it out).
This approach seems better to me than using the in-system programming setups I found all over the internet for a number of reasons:
- I don't have to figure out how to wire a USB ASP or whatever you call it to my breadboard and my computer.
- If I build a prototype, I don't need to include a programming interface at first.
- When I go into production, I can flash chips more easily. ("Production" ... haha....).
I hope this helps someone, and I would be interested in feedback or questions. I also look forward to more AVR projects!
#include <avr/io.h> #include <util/delay.h> int main(void) { DDRB |= (1 << PB0); /* Replace with your application code */ while (1) { PORTB = 0b00000001; _delay_ms(1000); PORTB = 0b00000000; _delay_ms(1000); } return (0); }