Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

How to get started with 8-bit AVR?

Status
Not open for further replies.
Hi, everyone.

I've decided to take up the 8-bit AVR microcontroller architecture. I'm thinking of buying an STK600. I want to program a variety of devices, including the smallest 6-pin chips. I want to use C and assembler. I also want to be able to easily produce input/output in software, and to see the output in hardware, whether it be by flashing LEDs or whatever.

1. Will the STK600 allow me to program the smallest, lowest-pin-count chips?

2. Do I need anything else other than the STK600 to meaningfully program the AVR and watch it in operation, and interface it with electronic devices such as motors, LEDs, etc?

3. Will I be able to program the AVR while it is in-circuit? I want to be able to design my own circuits with the AVR in a socket, and program the AVR while it's in-circuit.

Richard
 
1: That you should find in the STK 600 Manual - I don't have a STK 600.
2: Watch in Operation->That's called JTAG. When STK 600 supports JTAG you can look into the Controller while working, set breakpoints and so on.
To connect external comonents should be possible with the STK 600.
I would suggest you, to start with the STK 500 Board. Its much cheaper and supports DIL housings.

3: That is possible with nearly all AVR's its calles ISP. Additional you need a ISP Programmer. The solution from ATMEL is called AVR ISP MKII.
But there are many other Manufactors that built such stuff. There are 2 possible Connectors. First a older 10pin Header, then the newer 6pin Header.
The newest Generation XMEGA ( 32 Bit ) uses a other Programming scheme.

For all that tools you can use the AVR Studio 5 Software that's free downloadable from ATMEL. There is an C Compiler included.

When you have an older PC I would suggest you to use AVR Studio 4.xx and the free Software AVR GCC / WIN AVR. That combination runs better on older PC's.
 
I have an STK600 and I like it very much. There are few things you should consider though.

1. Will the STK600 allow me to program the smallest, lowest-pin-count chips?

Yes, but you need to buy an adapter card for every package type. These can cost from 50 to 120 dollars.
**broken link removed**
http://store.atmel.com/SearchResult.aspx?q=gsd:k-socket+card

2. Do I need anything else other than the STK600 to meaningfully program the AVR and watch it in operation, and interface it with electronic devices such as motors, LEDs, etc?

STK600 supports JTAG, ISP, PDI, aWire, Serial/Parallel High-voltage, but only for programming. The STK600 does not support debugging through these interfaces. For debugging, you need to buy a debugger like AVRDRAGON, JTAGICE mkII, AVRONE!.. STK600 has connectors for these debuggers. Once you have the right Socket Card, you can easily interface your own hardware (sensors, actuators etc.) with the microcontroller. All the IO is available through standard header pins.

3. Will I be able to program the AVR while it is in-circuit? I want to be able to design my own circuits with the AVR in a socket, and program the AVR while it's in-circuit.

Yes. Take a look at the STK600 manual: **broken link removed**

Cheap way to try out AVRs is to buy an Arduino, Teensy, XPlained or similar development board with a bootloader. Bootloader enables you to download code without external programmer. One thing to consider is just to buy a programmer/debugger like JTAGICE mkII and build your own prototyping boards. If you have decided to work more with AVRs, STK600 is a very good investment. Try out the new XMEGA family of microcontrollers.. they are really cool devices :)
 
Last edited:
I use AVRs and don't have a development board. I develop and build my own systems. If I need to know what's going on internally with my code, I generally pulse an IO pin in each module with a different pattern, so I know when and what module the code goes through, or use a different pin (if available) for different modules. I also write my routines and check them out one at a time, so I know they are working properly before calling them. I use an older PC (it was new when I bought it 8 years ago) and use the Studio 4 from Atmel (big change from the 3), and bought an ISP for $29 from Digikey (my first programmer was free from the Atmel distributor, as I bought 1020 ATMEGA8 controllers for my first project). I don't even stuff the 6 pin header on the board, I put it in the ribbon cable and just hold it in place while programming a board (production), but it is helpful to stuff them in the first unit (prototype) boards as you'll be constantly reprogramming (the code just never seems to want to work on the first pass).
 
I use an older PC (it was new when I bought it 8 years ago) and use the Studio 4 from Atmel (big change from the 3)

Have you noticed that there is Atmel Studio 6.0 out already? Have you tried it? I think you should at least update your compiler.. if you use C.
 
studio 6.0 is a very big change from studio 4. The normal stuff works pretty much like the old one, but you get some code auto-completion and other modern code functions.
Just don´t be too keen on the asf framework, it is just a pretty much undocumented mess, so you spend hours diving into it to find how you should use it.
 
studio 6.0 is a very big change from studio 4. The normal stuff works pretty much like the old one, but you get some code auto-completion and other modern code functions.
Just don´t be too keen on the asf framework, it is just a pretty much undocumented mess, so you spend hours diving into it to find how you should use it.

Yes I agree. They try to take the IDE to the same direction as Visual Studio, but it is quite unfinished and maybe a little too "fancy". I hope the next version is more finished product and that they don't add too much new stuff.
 
Last edited:
Have you noticed that there is Atmel Studio 6.0 out already? Have you tried it? I think you should at least update your compiler.. if you use C.

no, no, and no... I did not know 6.0 was out, I don't use C, and, er, um, what was the question??? I do everything in asm. I believe high level compilers are for mainframes, and embedded controllers should use asm for realtime computing... old fashioned, I guess, but I've never had a problem getting the code to do what I need it to do... and high level compilers are a waste of CPU cycles. I probably should try Studio 6.0, but I just don't want to go thru the learning curve (and please don't make me learn to use another phone, either)...:)
 
no, no, and no... I did not know 6.0 was out, I don't use C, and, er, um, what was the question??? I do everything in asm. I believe high level compilers are for mainframes, and embedded controllers should use asm for realtime computing... old fashioned, I guess, but I've never had a problem getting the code to do what I need it to do... and high level compilers are a waste of CPU cycles. I probably should try Studio 6.0, but I just don't want to go thru the learning curve (and please don't make me learn to use another phone, either)...:)

That is cool. There's been many forum battles because somebody asks "should I learn ASM or C".. I don't want to turn this into such battle. Just want to say that I program with C and have learned ASM on the side because sometimes that is the only option. I always check what my compiler is doing. And some parts need to be optimized using inline ASM. I have no trouble wasting CPU cycles if I can afford it :) So, if you start with C, be prepared to learn ASM too.

Reading between the lines I predict you won't like the Studio 6.0 very much.
 
Reading between the lines I predict you won't like the Studio 6.0 very much.

ya, my handle should've been olphart, but it was taken!!!!
My C instructor was a mainframer. He couldn't even give an explanation of why C printed out 16961 when you dim'd an array of chars, loaded it with "A B C D...etc" and then printed out the first element as a variable. I hit a few buttons on a calculator and raised my hand and explained it to him (er, A = 41H and B=42H, so 4241H = 16961 decimal, duh). He was just content enough to show that it would do that.
It is good to know what your software's doing. I also looked at the compiled code when I programmed in C (lots of pushes and pops, that's for sure).
And ya, going through a control loop 100 times a sec vs 200 times per sec is not a big deal... let's just not let it creep down to the once a sec time frame... :)
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top