688Views16Replies

Author Options:

AVR Help Answered

I finally have all I need to start programming, I have a programmer (this one to be exact)
http://cgi.ebay.com/ws/eBayISAPI.dll?ViewItem&rd=1&item=130202441672&ssPageName=STRK:MEWN:IT&ih=003
and I have a bunch of attiny13v
You can talk to me as if I know nothing about microcontrollers and programming.
I have googled for about 10 minutes and havn't found a tutorial or anything that can help me. I just want to learn the most up to date stuff, like I don't want to learn assembly if I can use C (I don't know C). Please, I need help.

Also I need help of how to setup everything on a breadboard, like what pin of the 10 pins from the programmer go to which pins of my attiny13 and where to apply how much voltage.

Tags:AVRHelp

16 Replies

user
twenglish1 (author)2008-07-12

hey im new to programming too and i was wondering if anybody knew how to use a push button switch with the attiny13

Select as Best AnswerUndo Best Answer

user
twenglish1 (author)twenglish12008-07-12

to like turn an led on and off

Select as Best AnswerUndo Best Answer

user
westfw (author)twenglish12008-07-12
Yes.

So let's say you want to have a button and an LED connected to a tiny13, so that when you push the button, the LED goes on. Then if you push the button again, the LED goes off. Sorta like any number of electronic gadgets you can buy. You'd have a circuit that would look something like the one attached: LED connected between one pin and GND through a resistor, another pin connected by the button to GND, with a "pull up" resistor to V+ to keep in the high state when the button isn't pushed.

Then your software will logically look sorta like this psuedocode, regardless of the actual language you use:
if buttonPushed    if (LED is on) then turnLEDoff    else turnLEDon

buttonPushed checks the IO pin (set to be an input) with the button to see if it's low or high. It gets slightly complicated because switched "bounce" if you look at them in enough detail; each button press will look like MANY separate signal state changes, so the routine really has to check "see if the button stays in the 0 state for some continuous amount of time.") And then you don't one LONG button press to make the LED blink. so somewhere you have to wait for the button to get un-pressed (which also bounces.)

Are those enough hints?

Select as Best AnswerUndo Best Answer

user
twenglish1 (author)westfw2008-07-22

im using C could you help me with the code cause im really new to it and only know a few things about it

Select as Best AnswerUndo Best Answer

user
twenglish1 (author)westfw2008-07-13

yes that helps thanks for an answer

Select as Best AnswerUndo Best Answer

user
guyfrom7up (author)2008-04-24

Bringin this back up Can anyone recomend a good AVR book? something like under 30 bucks that has examples, explanations... Stuff that explains ADCs and how to program various things?

Select as Best AnswerUndo Best Answer

user
westfw (author)guyfrom7up2008-04-24

It's hard to beat the datasheets, once you get used to reading datasheets.
Also, see the articles and Tutorials at AVRFreaks.net

Select as Best AnswerUndo Best Answer

user
gmoon (author)2008-04-18

Here's the pinout for an STK200/300 ISP header.

You'll be able to find the MOSI / MISO / SCK / RESET pins on the attiny13. Add a 10K pullup on the RESET pin and they recommend a 10uF cap between Vcc and GND for every AVR, and you'll be good to go.

C will work work the attiny13 (unlike the 11, 12, 15 and 28--they don't have any volatile memory, other than registers), although with only 64 bytes of ram you'll be limited in the "depth" of function calls, variables, etc.

The attiny13V has a wide voltage range (1.8 - 5.5V) so it's easy to power. Looks like your programmer works in the 2.7 - 5V range.

Also looks like you supply power for the board project (programmer doesn't supply any.) So I doubt the 5V+ pin on the STK200/300 would be active on the programmer--that's OK, so long as both project board and programmer share the GND...

Select as Best AnswerUndo Best Answer

user
guyfrom7up (author)gmoon2008-04-18

check check... and check, now my breadboard is already! Thanks!

I just found this tutorial and I'm downloading a buttload of stuff
http://tinkerlog.com/2007/06/03/programming-avr-with-eclipse-and-winavr/

is all that info good?

Select as Best AnswerUndo Best Answer

user
gmoon (author)guyfrom7up2008-04-18

Hmmm I guess Eclipse is a dev environment, and I don't use it. That looks like mostly like instructions on how to configure the Eclipse IDE to work with avrgcc (which might be worth trying.)

I also don't know if you're using Windows or Linux... Assuming Windows (I mostly use Linux.) But I have AVR Studio 4 installed, too.

AFAIK, AVR Studio 4 still includes a current build of Winavr, which includes avrlibc, avrgcc, a makefile builder, etc. If not, here's the website (and help) for Winavr.

If you use Linux, you can usually use "synaptic" and install all the AVR packages or debs easily. In use, it's definitely a different approach than using AVR Studio, tho. I was pretty comfortable with gcc before I picked up an AVR, so it was natural, in my case...

Select as Best AnswerUndo Best Answer

user
zachninme (author)gmoon2008-04-18

Synaptic is only for apt-based package managers, I believe. But I've had luck finding the packages in a multitude of distros, they're generally "avr-gcc"/"gcc-avr", "lib...avr", and "avrdude"

Select as Best AnswerUndo Best Answer

user
gmoon (author)zachninme2008-04-20

instead of usually use "synaptic", perhaps use synaptic or similar package manager would have been clearer.

Then just search for "AVR" and install everything (you won't need everything, but there's probably no more than 10 or 12 AVR packages anyway...)

Select as Best AnswerUndo Best Answer

user
zachninme (author)gmoon2008-04-20

In hindsight, I didn't have to correct you... sorry about that. But I agree, searching for "AVR" should return everything you'd need.

Select as Best AnswerUndo Best Answer

user
guyfrom7up (author)gmoon2008-04-18

I'll check avrstudio out tomorow (I'm tired, can't seem to concentrate on this stuff at this time) and yeah, I have windows, thatn's for your help, I'll post more problems if I have them ;)

Select as Best AnswerUndo Best Answer

user
guyfrom7up (author)guyfrom7up2008-04-19

ok, I have it installed and everything, can you recomend me to a good C site, I have no clue what I'm doing (closest thing that I've done to this is arduino)

Select as Best AnswerUndo Best Answer

user
NachoMahma (author)2008-04-18

. This is not the same product, but the schematic is available and the pinout should be the same.
. And here's a PDF with the attiny13 pinout.

Select as Best AnswerUndo Best Answer