Wednesday, November 28, 2012

EMBEDDED SYSTEMS TUTORIAL3- MAKING OUR FIRST PROJECT -PART2......



Hii ..........friends this is second part of our first project tutorial,In this part we will discuss how to program our AVR MCU with the hex file which we have generated. here is step wise process for burning the microcontroller and implementing and testing our very first LED blinking project.



PROGRAMMING THE MICROCONTROLLER WITH HEX FILE

First of all connect your UBASP to your computer now connect programmer to target board . generally a target board is provided with programmer if not then no problem just implement the circuit given below on breadboard or any general purpose PCB. And connect the programming pins to ISP header of programmer in this manner.







Now start PROGISP it will look like this








Choose your device i.e. ATMEGA 8 or whatever you are using, check the functions as shown, load the flash( hex file from the project folder) click on auto …and burning starts.








             If everything was correct till now flash will be loaded successfully.



TROUBLESHOOTING

In case flash is not successfully loaded
 
1. Make sure programmer is working fine.
2. programmer is rightly connected to target board.
3. target board is powered up accurately.
4. In case of new ATMEGA 32 set high and low fuse bit to 0xC9 and 0xFF.




       So our microcontroller in now programmed and we have to implement the circuit it is so simple , implement given below circuit on a breadboard or vero board and provide power supply now u can see our led is blinking and we have completed our very first AVR project successfully.



 
      you can use similar circuit for ATMEGA16 and ATMEGA 32  just check datasheet for power supply pin and PB1, rest will work fine.

TROUBLESHOOTING

In case your project is not working.
1. Check  weather power supply is properly connected.
2.  Make sure circuit is not wrong.
3. Make sure LED is connected to right pin.

                                                        So this was our first blinking LED project , we implemented it successfully , I hope it was beneficial for all of you. if you have any doubts, questions, critical view you can leave comments.  In case if you have faced some problem with hardware and your project was not successful do not worry in next Tutorial we will make this project on PROTEUS and will virtually simulate our project.....till then bye.....:)




                                       THNX....:)

EMBEDDED SYSTEMS TUTORIAL3- MAKING OUR FIRST PROJECT -PART1



Hii guys again I am here with my 3rd tutorial on embedded systems. I hope you have arranged all the required hardware and softwares. So today we are going to compile our first code using AVT STUDIO 4 and then we will burn the hex file to MCU with the help of USBASP programmer using PROGISP. Here  I have inlisted complete stepwise process to work on AVR STUDIO4 and programming the MCU. First of all install AVR STUDIO 4, WIN AVR and PROGISP with normal installation processes. Also install drivers provided with USBASP programmer as directed in documentation of product.





1.       COMPILING THE CODE


              Lets start our AVR STUDIO4 when it will start it will look something like this.

           



         To create a new project Choose NEW PROJECT. Now after choosing new project window will look like this

 



         



Now click on AVR GCC , give project a suitable PROJECT NAME and  SAVE it in desired location click NEXT, and window will turn to something like this.










Now Select Device here we are going to work with ATMEGA8, if you have ATMEGA16 or ATMEGA32 no problem same process will work fine just choose your device ,click finish, a new will open now.









Now there are three sections
 
PROJECTS SECTION- here the files used  in project are shown you can add additional file in this section.

CODE SECTION- in this section the source code is written and edited accordingly.

MESSAGE SECTION- this section shows suitable messages after compiling . Errors and warnings are displayed in this section.
 



Now copy this code from here and paste it in the code section. If you do not understand the code don’t worry I will teach about various programming aspects in next tutorials.


#include<avr/io.h>
#include<util/delay.h>

int main(void)


{

    DDRB=0b00000010;  // PB1 of PORT B is set as output connected with LED
    while(1)
    {
        PORTB=0b00000010;  //LED at PB1 set ON
        _delay_ms(200);

        PORTB=0b00000000; //LED at PB1 set OFF
        _delay_ms(200);
    }
}
 





Now click on build button or click   fn+f7   ………..and compiling started…J


If everything is correct build will succeed with 0 errors and may be with some warning do not worry about warnings build one more time and warnings will be eliminated.

Now after this much process your compilation is complete and u can see now hex file is generated in project folder . this is the file which will be fed or burnt in the microcontroller because microcontroller understand instructions given by hex file only.This was the compilation part now in next part we will burn this  generated hex file in our microcontroller. I hope this tutorial was beneficial for u all ,if u have any doubts , questions or critical view just leave your comment.............cntd. to  EMBEDDED SYSTEMS TUTORIAL3- MAKING OUR FIRST PROJECT PART2




                        THNX...:)




Tuesday, November 27, 2012

EMBEDDEDD SYSTEMS TUTORIAL2- REQUIREMENTS




Hii friends I am here with my second article on embedded systems, this time we are going to discuss about the requirements for starting our journey with AVR. There are a few hardware and software requirements to start with. After arranging all these we will be able to start our first project.



HARDWARE REQUIRED

 
1.A PROGRAMMER –


 A programmer is required to burn our hex file (if you are not aware with hex file dont worry we will discuss about it in next tutorial) into our microcontroller in my tutorial series I am using USBASP programmer . USBASP is a low cost programmer its easily available in market or you can buy it online from any trusted site . it can be implemented on a circuit board ( I will post another tutorial on making your own USBASP programmer later) but I will advice to buy it from somewhere.

2.A TARGET BOARD –

A target board can be your own development boards with ISP header to connect and disconnect the programmer ( though in my tutorials I will use bread board or hand made circuits but if you are a newbie you can purchase a AVR development board from any electronic shop or trusted sites ..its easily available) or you can make your own .


3.A PC/ Laptop with windows98 or BETTER THAN THAT.


                                                  And of course our AVR MCU.



SOFTWARE REQUIRED-



1. AVR STUDIO 4 


It is  GUI IDE for AVR,  you can download it by   CLICKING HERE   its totally free..:P 


2. WIN AVR


It is free C compiler from AVR , can be downloaded by  CLICKING HERE .

 
3. PROGRAMMING SOFTWARE


We will need a software to burn our hex file to MCU for this we need a programming software . There are many softwares like avrdude, pony prog, extreme burner but I am using PROGISP in my projects you can download it BY  CLICKING HERE  its totally free.


            So these are the basic requirements for starting , arrange all the stuff and wait for next tutorial where we will compile our code ,burn hex file to MCU and will make our first blinking led project. In case you are not able to arrange it, no problem I will show you how you can simulate your microcontroller projects on PROTEUS ( a very nice circuit simulator software)…….I promise next tutorial is going to be a very good starting tutorial for all the beginners…if you have any doubts , questions, suggestions, or critical views you can post here......I hope it was a useful article for u all. 


                                                                         THNX..:)