Search This Blog

Powered By Blogger
Showing posts with label atmel avr microcontroller tutorial. Show all posts
Showing posts with label atmel avr microcontroller tutorial. Show all posts

Wednesday, September 18, 2013

So,you want to start learning microcontroller and other embedded stuffs?

Hello guys,
Well...this is a post for newbies in microcontroller world.Here,I didnt mean a complete newbie by the term "newbie".I am neither gonna talk about resistor capacitor and transistors nor what is microcontroller etc.This post is for someone who knows at least what a microcontroller is and wants to start learning it and requires a guide line on how to start.

WELL...you know what a microcontroller is...hmm???okay...thats cool.Now lets talk about how to start.Well...the first thing is to choose a microcontroller family.Well...I dont want to hurt the feelings of the fanboys of other families...but AVR from Atmel and PIC from Microchip are the two best families for newbies currently...its because of the gigantic number of tutorials and example projects you are gonna find online. www.extremeelectronics.co.in is an excellent site for learning both these families,or the winavr.scienceprog.com for AVR.One hint for the first site...their tutorials are kept in reverse order...so for getting the basic tutorials...u need to go to the last page of the tutorials.
Now lets come to another very very important thing...availability of microcontroller and tools.Well...u need a microcontroller and a tool to program it.Now if you are  not confident enough to make your own programming tool or if you havent got someone who can do it for you,I recommend you buy one...for PIC,buy Pickkit2 or 3(2nd one isrecommended).If you cant buy them,look for their clones.I am giving a few links here

http://www.microchip.com/stellent/idcplg?IdcService=SS_GET_PAGE&nodeId=1406&dDocName=en538340&redirects=pickit3

http://www.ebay.com/sch/i.html?_odkw=usbasp&_osacat=0&_from=R40&_trksid=p2045573.m570.l1313.TR0.TRC0.Xpickit2&_nkw=pickit2&_sacat=0

http://www.ebay.com/sch/i.html?_odkw=pickit2&_osacat=0&_from=R40&_trksid=p2045573.m570.l1313.TR0.TRC0.Xpickit3&_nkw=pickit3&_sacat=0

You can check other sources too.

For AVR,

http://www.ebay.com/sch/i.html?_odkw=pickit3&_osacat=0&_from=R40&_trksid=p2045573.m570.l1313.TR2.TRC1.A0.Xusbasp&_nkw=usbasp&_sacat=0
This little programmer is really cool,but its not their official programmer...but you can use it...In fact,I use it for my work and it works just great

http://www.atmel.com/tools/AVRDRAGON.aspx
This is the official one.

Now...a million dollar question...which one to choose???PIC or AVR...well....u guys wont even believe that this question can trigger World war 3(u will see someday,trust me)!!!Well...I would say...go for any.See which one you can afford(Talking about tool),which one is available in your country,..or which one your friend or known ones are using(this suggestion has been given so that you might get help from them).
Now...both Microchip PIC and Atmel AVR are families,not a single microcontroller.There are hundreds of different models of PIC and AVR microcontrollers...My advice is,decide which one you are gonna use,get to the market and buy one model,any model.But onw thing you must know...for starting,choose from 8bit PIC or AVRs...For AVR,I would suggest ATmega16 or ATmega32(a good general purpose microcontroller).For PIC,go for PIC16F877...these micros are highly available AFAIK.
Now...one thing.you might have heard about another thing,ARDUINO....right?????If you havent,dont try to know about it for now.If you have and your friend told you its extremely easy bla bla bla,Now,for that,I want to ask you a question,
Why do you want to learn microcontroller???Is it just for some university term project?Are you going to wipe off all you microcontroller lessons after that project???or do you want to learn microcontroller and become a professional embedded systems expert in your future life?If the first one is the reason,you can go for ARDUINO...but if the second is the reason,dont even think of getting near it for now.Its an excellent platform that uses several microcontrollers from Atmel AVR family(or Microchip PICs or ARMs in different but similar platforms).Its like a magical tool for rapid prototyping etc. and its highly tempting for newbies as well since its extremely easy to use...but sometimes shortcuts DO come with their side effects.If Arduino is your first choice for "learning", you wont even scratch the surface of this vast embedded systems world.First,learn the basics of AVR or PIC,then you will be able to use an Arduino to its limit.So, for now,forget the word Arduino.Its not for newbies who want to become professional.First learn AVR/PIC,then move to Arduino....the path wont be smooth,but at the end of it there is a huge reward.

Saturday, April 17, 2010

Getting Started with avr microcontroller

Well...time to stop this history lecture and come to the point.We are using atmel avr microcontroller.Many of you may ask why we are using this one.Well...actually I have already answered it but missed one point.Atmel guys write their datasheets very well and they are easy to understand(Datasheet is the documentation of the device you are using...means pin configs,register descriptions etc.).
Atmega16 is an 8bit avr microcontroller with 16k in system programmable flash.Well...after all these almost non-technical stuffs,the aforesaid one is like instantly changing speed from as slow as a cycle to as fast as a bullet train!!!Well, avr is a computer architecture developed by Atmel.It's a modified harvard architecture system.8bit means the register size(a temporary memory where data can be stored,exchanged etc.) is limited to 8bits and more precisely...the arithmetic logic unit(CPU) can process 8bit data at a time(maximum).Register is like a set of memory blocks.Each of them can store one bit(0 or 1).So each register of avr should have 8blocks for 8bits.There are some 10bit,16bit registers too,but they are actually collections of several 8bit registers(We shall see them in datasheet).
Now...what is that "in system programmable flash" thing?Well...flash is a non-volatile memory and in avr microcontroller(and in many others),this is the memory where the program you have written is kept."In system" means you can program the microcontroller even after installing it in your circuit.That's a great thing because you don't need to remove uC from circuit to program it.You just power your circuit and connect your programming hardware to it and just send the program from your PC or Laptop!
Now...I have stated something new here what I haven't stated before:"Programming Hardware".Well...Since the beginning of this tutorial I have been saying that uC can be "programmed".But how?You can't just load the program into a pendrive and then insert it into uC!You need a circuit that will work as an interfacing medium between the uC and your PC.This is the programming hardware.There are many kinds of programming hardwares available for avr(We will discuss it soon).
Besides, you also need a software that will use the hardware to send the program to uC.Well...we will discuss it too!
Now...let's come to datasheet.I said you need it to know about the uC you are using.Seeing it you can know the features of your uC,pin config, internal devices and how to access them through your code etc.A very good video on accessing the datasheet is about to be published(It's on atmega8 but you can easily get the main theme).Well...let's move to our next chapter.

Sunday, March 14, 2010

Atmel microcontroller tutorial - Index

hi guys.I am Shovon(M.E. BUET).I am an electronics and robotics enthusiast.I have been working with uCs for a long time and I have collected valuable infos and willing to share 'em. I am writing a tutorial on uC(Microcontroller).The uC I'm gonna use is Atmel Atmega16(8,32 will be ok).Well,let's keep this mumbo jumbos short...and move to the tutorial
N.B. :-For descriptions...see other blog posts
Here is the complete index:
Atmel uC tutorial
  1. 8 bit timer
  2. 16 bit timer
  3. Project - a clock
  4. Special application - the PWM
  • Analog to digital converter - the magical connector between analog and digital world!!
  1. ADC description
  2. Some Coding
  3. Project - voltimeter
  • LCD Display...your monitor for uC Computer!!
  1. Overview
  2. LCD pin configuration
  3. Now... some coding
  4. Project...LCD Clock!!
  • Make your uC remember things even when it's turned off - the EEPROM
  1. Overview
  2. Registers
  3. Some Coding
  4. Project...Alarm Clock
  • Tick...Tick...Tick...tititi...Time to communicate with your pc...the USART
  1. Overview
  2. Serial Communication Basic
  3. Register
  4. Project...computer controlled stepper motor
  • Some other uC stuffs
  1. Serial Peripheral Interface - SPI
  2. I2C/TWI
  3. Some good tutorials on uCs