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 ads by
Signing Up











































Visit Our Store »
Go Pro Today »




http://www.atmel.com/microsite/avr_studio_5/
I did not see anything that referenced Linux nor MAC OS, sorry.
Tanks :)
Many components today use 3 volts, two AA type batteries provide this (1.5v each) but if you use rechargables they can be 1.2v each or 2.4v total... so you need to watch that. Sometimes I'll use 3 of the AAA rechargables... 3.6v... that seems to work... then use a ZENNER diode to clamp it at 3.0v.
...probably another Instructable!
I installed BASCOM, typed in a demo program, hit compile, hit program, and it worked the first time. I installed AVR Studio, took about 40 minutes to configure it, another 20 to figure out how to load the software, then never really did figure out how to compile it, which files needed to be included, etc.
Frankly, I gave up and went back to programming in BASCOM because I knew that I could use it and complete my projects. So far the only C type IDE that even comes close to being easy to understand is the one for the Arduino. (I'm currently learning how to use that now.)
Someone who started off with C may have a different opinion... but I have taught about 350 to 400 people how to program in BASCOM... the youngest was about 7 at the time. So the advantage... easy to set up and learn while still being powerful. If there is enough interest, I'll do another session showing how to make an LCD run. (That's what I did in my BLOG.)
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.
Most people go to the Arduino boards... which are okay, but you need to have a pre-programmed Atmel chip. With BASCOM you just get it from the factory and go. Plus... if you make a project that you want to mas produce, you can order the chips pre-programmed from the factory with your HEX code already in them ready to be installed.
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
Austin - http://therobotgroup.org
St Louis - http://robomo.com
Thanks,
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
I set the whole port for simplicity, but I could have used DDRA and DDRB to configure each pin.
DDRB =&B00000111
"0" is an input, and "1" is an output... in our example "&B00000111" will set PORTB.0, PORTB.1, and PORTB.2 to OUTPUTS, (right to left) the remainder being INPUTS.
Video added... drawing in the works now.
The Arduino is built using an Atmel AVR, but they have loaded software (a bootloader) into the chip already. This defines certain pins and functions for you. We are going a step above that... we are taking a raw chip and programming and defining it the way we want to.
Does the chip already have a bootloader on it when programming it with BASCOM or does it not need one?
Thanks for your informative replies :)