3 Simple Ways to
Share What You Make

With Instructables you can share what you make with the world — and tap into an ever-growing community of creative experts.

PhotosPhotos

Share one or more photos of a project, recipe, or whatever you've made, quickly and easily.

Step by StepStep-By-Step

Share your step-by-step photos with text instructions of what you made so others can do it too!

VideoVideo

Share your how-to video. You'll need your embed code from a video site such as YouTube.

Getting Started with Atmel AVR and BASCOM

Getting Started with Atmel AVR and BASCOM

I have seen plenty of Instructables showing how to work with microprocessors, but they all assume that you have worked with them before and know what you are doing. I have not seen an Instructable that takes you from nothing and builds on each step.

What we will do here is to start with a bare breadboard and build each connection and each component until we have everything we need to program a microcontroller to do something. In this Instructable we will blink some LEDs in sequence... then if you build this circuit... your first project can be to change the code slightly to make it into a traffic light.

I picked an older Atmel chip, the Tiny-26 to get started. It is a smaller microprocessor, very inexpensive, and easy to understand. Once you understand what we are doing here, you may want to try a more powerful chip like the Mega-328P which has more pins and more memory.

Note: The Tiny-261, Tiny-461, and Tiny-861 are pin compatible newer versions of the Tiny-26. They have 2K, 4K, and 8K of memory. If used, simply change the header by selecting the appropriate chip and recompile the program to use the newer version. The new chips have more functions that can be assigned to each pin. See the datasheets for more details.
Tiny 261, 461, 861 Datasheet (PDF)
Tiny 26 Datasheet (PDF)

Below is an image with the pins for the chip we will be using... we will be connecting the power and ground... in this case 5v. So where do we get 5 volts? We will build a power supply from a 9v battery.

Let's get started!

Video posted in a larger size at: http://www.youtube.com/watch?v=Jxica6Yenh8


 
Remove these adsRemove these ads by Signing Up
 

Step 1Breadboards and building circuits.

Breadboards and building circuits.
«
  • instructables2.jpg
  • instructables1.jpg
Below you can see a breadboard... they come in many sizes depending on how complex the circuit you want to build will be. We will use a medium sized breadboard with enough room for our power supply, the microprocessor, and the LEDs we want to control.
« Previous StepDownload PDFView All StepsNext Step »
16 comments
Jan 19, 2012. 1:00 PMMic100 says:
Good system with the 9Volts Battery
Tanks :)
Sep 17, 2011. 8:57 AMQtechknow says:
Which program should c/c++ programmers use for the atmega 328?
Feb 9, 2011. 7:57 PMfrank26080115 says:
What would you say is the advantage of using BASIC over C?
Feb 28, 2011. 11:24 AMheatseeker96 says:
It's more easy to learn, use and debug. The problem with basic is that you can't do evrything with it.
Feb 13, 2011. 2:21 AMjanw says:
+1

BASCOM is so userfriendly and very intuïtive. It only takes about 5 minutes to setup the program for your programmer and off you go.

Bascom also makes working with all kinds of different communicationprotocols very easy. I2C, 1wire,.... they have all their set of easy to use commands.
Feb 9, 2011. 9:12 PMfrank26080115 says:
Ah, I overcome the bad IDE problem by just writing my own
http://code.google.com/p/avr-project-ide/
Now I use NetBeans too

About "which files needed to be included", check out http://www.nongnu.org/avr-libc/user-manual/modules.html
Feb 13, 2011. 2:27 AMjanw says:
Great instructable!
Feb 9, 2011. 5:59 AMAgeingHippy says:
Hi Jerry

Nice and clear. Thanks.

I am wondering though, PB0-PB7 can only all be input or all be output?

I have a little (very little) experiance with arduino and my inderstanding was that one can define a pin (as apposed to a port = 8 pins) to input or output.

Is this perhaps a diferent type of chip or is defining the port as input /output a shortcut for defining all 8 pins seperately?

Also, what might be usefull would be a circuit diagram to match to your boards.

Thanks
Feb 9, 2011. 6:02 AMAgeingHippy says:
Sorry - also wanted to ask more.

Does the chip already have a bootloader on it when programming it with BASCOM or does it not need one?
Feb 9, 2011. 10:12 AMAgeingHippy says:
Great.

Thanks for your informative replies :)

Pro

Get More Out of Instructables

Already have an Account?

close

All Steps Viewing
View all steps of an Instructable on the same page when you're a Pro Member.

Upgrade to Pro today!
8
Followers
2
Author:askjerry
I like rockets, robots, and CNC.