696Views16Replies

### Author Options:

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:

## Discussions

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

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?

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

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?

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...

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...

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"

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...)

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

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 ;)

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)

. 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.