Category: MicroControllers


 

First time in India , VEGA ROBOKITS has engineered a development board universal to both AVR & 8051 ICs.The board has in built Programmer capable of programming both AVR & 8051 family ICs.

 

board2

 

A 40 pin ZIF socket is used as Target to hold the 8051 IC. Additional 40 pin ZIF socket with modified connection is provided to host AVR ICs.This additional ZIF socket should be placed over the on- board ZIF socket to use AVR ICs.

 

 

image4

 

board1

 

8051 PROGRAMMER & DEVELOPMENT

To start with we shall see how to use this board for 8051 development.

Select switch 1 to USB position ,if you connect the board to PC using A to B USB cable.Now the power is taken from USB itself. If this switch is selected to other side , the board needs an external 12v/1A adapter.

Select the ISP switch (switch 2 near the middle of board) to ON position.This makes sure that you’re going to program the chip .

Put the jumper (found on top of I2C EEPROM IC) on 8051 position.

 

WILPRO’s WLAR software is used as an application to fuse the HEX files.Download the zip file from :

http://www.alselectro.com/files/wlpro_v220_setup.rar

No installation is required.It is a standalone application.

Download the drivers required for this board from :

http://www.prolific.com.tw/UserFiles/files/PL2303_Prolific_DriverInstaller_v1_10_0_20140925.zip

Unzip the driver file & double click on  “PL2303_Prolific_DriverInstaller_v1.10.0 “  EXE file to install the drivers.

Connect the USB cable of board to PC & open the DEVICE MANAGER.

If the PORT allotted is within range 1 to 9 , you can start the WLPRO application and proceed to load HEX file.

If the port allotted is a double digit , then WLPRO will enter DEMO mode .Only in ON LINE Mode you can load the HEX file.

 

g1

 

To solve this , RIGHT CLICK on the port allotted inside Device Manager & select PROPERTIES.

Under PROPERTIES window select PORT SETTINGS

 

g2

Click on ADVANCED button under PORT SETTINGS.

 

     g3

From the DROP DOWN you can select a PORT number between 1 & 9  &  click OK.

If the port number is not free , you can try overwriting the pre allotted port number & confirm.

 

g4

 

g6

 

g5

 

After PORT setting to single digit  , open the WILLAR software . Now you can see ONLINE MODE at the bottom of screen.

 

g7

Click on DEVICE button & select the target device as AT89S51@ISP 

If you select plain AT89S51 , DEVICE ID ERROR will be returned while programming .So make sure to select the ISP version as device.

Image 6

Click on LOAD button & browse to the location of the HEX file to be fused.Select the HEX file & then click OPEN.

 

g9

 

On the next LOAD FILE window leave the File type as “INTEL HEX” & CLICK ok.

g10

 

You’ll see LOAD FILE SUCCESSFUL display.

Image 7

 

Now click on the PROGRAM button on the left pane.

prog1

 

Programming is DONE & you get Program Successful display.

Image 8

 

If you click the AUTO mode button , all functions like Erase,Blank check ,Program,Verify & code copy Protect will be done automatically one by one.

Image 9

To test the program loaded , change the switch 2 to ISP OFF position .Push RESET button to see the result of blinking LED .

 

AVR PROGRAMMER &DEVELOPMENT

 

Select USB ON (switch 1)

Select the ISP (switch2) to ON position.

Put the Jumper on top of I2C chip to AVR position.

Place the converter socket on the ZIF socket & lock it.Make sure that the handles of sockets match.Do not place the socket in REVERSE as it may damage the target IC.

 

Image 15

On WILLAR IDE select the DEVICE as ATMEGA16L@ISP 

Ensure to select ISP version of IC & not the plain one.

Image 11

 

Select File type as INTEL HEX & click OK.

 

Image 12

 

Click on LOAD & browse to the location of AVR HEX file .

Click OPEN to LOAD the file.

Image 13

 

After LOAD SUCCESSFUL display click on PROGRAM to fuse the file.

 

Image 14

 

Watch this support video  :

 

8051 / AVR UNIVERSAL DEVELOPMENT BOARD WITH PROGRAMMER

For availability of this board contact :  

 

http://www.alselectro.com/8051_avr-2-in-1-development-board-with-programmer-.html

 

cooltext753793315   cooltext753790696

 

Nowadays Laptops come preloaded with Windows 8 OS. For our Embedded software installation it is not possible to install Drivers , as WIN8 has added security against unsigned drivers.

For Windows 8 to accept drivers , we’ve to disable the security measure of testing unsigned drivers.

Particularly while trying to install AVR USB  drivers ,this security measure won’t allow you to install the drivers.

Follow the steps explained below to over ride this problem.

 

Under Charms bar click on the Gear icon “Settings”

Image 17

 

On next screen click on “Change PC Settings”

Image 18

 

On PC Settings screen under General scroll down to bottom to select “Restart Now “under Advanced StartUp

Image 19

 

Click On  Trouble shoot option

Image 20

 

Click On Advanced Options under Troubleshoot screen

Image 21

 

Select StartUp Settings

Image 22

 

Click Restart

Image 23

 

A list of Start Up Settings appear. Press number 7 on your key board to Disable Driver Signature Enforcement.

Image 24

Now your PC reboots with driver signature enforcement disabled.

Once you did this you will be able to install unsigned drivers.

Now connect your USBasp programmer to the USB port of your laptop. Ignore the message that ‘Device driver software was not successfully installed’.

Download USBasp drivers here

and extract it somewhere on your PC.

Go to Device Manager in control Panel and you will find ‘USBasp’ with yellow mark. Click on it and select ‘Update Driver Software.’

Image 27

select ‘Browse my computer for driver software’. After this browse to the location where you have extracted the USBasp drivers

Click next and ignore the security warning ‘Windows can’t verify the publisher of this driver software’ and select ‘Install this driver software anyway’

Image 28

 

Image 26

Now the drivers are successfully installed & you’ll see this :

 

Image 29

In this post we shall review VP812 programmer for loading .Hex file on to the target AVR chip.

This  is a low cost USB programmer & supports wide range of AVR & ATMEL ICs.

Picture 50    Picture 52

Vp812 has a Mini-B 5pin USB connector for communication.A suitable USB cable is provided with the kit to enable connection with PC.

Picture 54

Connect the USB cable to the PC and install the driver for the board.VP812 uses a

Prolific 2303HX chip, a full featured USB to RS232 bridge controller.Download the driver for this chip from

http://prolificusa.com/files/PL2303_Prolific_DriverInstaller_v1.7.0.zip

As soon as the drivers are installed,under Device manager you can expand Ports & confirm the Prolific port entry.

Image 10

To interface the board we use a program similar to WLPRO software used for programming 8051 chips (details here).

Download the  program from

http://sdrv.ms/TDHNYO

After installing the VP812 program,double click to start it .

Image 1

Click Connect so that the program recognizes  your hardware.If the driver is installed properly ,you get ONLINE mode indication at the right bottom corner.

Image 2

From the Menu under Device click Select Device.

Image 4

A separate window opens up where you select the target Device (ATMega16 in our case).

Image 3

Click on the INFO button and place the IC on the ZIF socket as per diagram.Take care to place the target chip in the correct position.

Image 11

You can also click the Config button to load the Fuse bits configuration.If you want, you can change the tick marks and program the Fuse bits.Before changing any of the Fuse bits be cautious ,as you may spoil the chip.

Image 12

Now click Load button & browse to the location of .Hex file (which is to be burnt on target chip)

Image 5

There are 2 modes of operation Manual & Auto.Under Manual tab you can do the individual tasks like Erase,Read,Program.. by clicking on the relevant Button.

Under Auto tab you can select the tasks to be performed automatically & click Auto Start.

Image 8           Image 9

As per the selection of Tasks the target chip is Programmed.A green LED (marked STA on VP812 board) blinks indicating the Status of programming.

Watch this support Video :

VP812 – AVR USB Programmer

 

This board can be used for programming ATMEL chips like 89S51,89S52,…

VP812 is the only board that supports programming of Philips chip 89V51RD2.

It even supports some 40 pin PIC IC s like PIC16F877A ,programming in ISP mode.

For availabilty of this Programmer contact :

cooltext753793315    cooltext753790696

 

In this post we shall see the ways of burning our .Hex file on to the target AVR IC .We created the .Hex file using WinAvr tools (Programmers Notepad & Make,link here ) or through the ATMELStudio6 (here).Of course ,in WINAVR we can use the Programmers Notepad Tool  (“Tools –> Program) to burn the .Hex file(tutorial 3 here).

AtmelStudio6 does not have a burner software.We have to make use of any one of  the external Burner software. As we have to feed the .hex file to the Burner software ,note down the location of the .hex file created through the Studio.

We shall see four of the best available Free  Burner software with nice Graphical user interface.

Watch these support videos  :

Part 1 : AVRPal.Net & Extreme Burner Programs

AVR Burners Part 1 (AVRPal.Net & Extreme Burner)

 

Part 2 :  AVR Burn-O-Mat  & SinaProg  Programs

 

AVR Burners Part 2

 

 

AVRPal.Net

Image 1

Download it from :

http://www.softpedia.com/get/Others/Miscellaneous/AVRpal-net.shtml

AVRpal.net is an Open Source Windows based GUI for the popular avrdude Command line utility for AVR microcontroller Programming.
It has got many features with a lightweight easy to understand interface. LibUSBdotnet driver and avrdude is provided within it.

Some features of AVRPal.Net are :

On Screen avrdude command execution watch , USB handling capability &  Auto detection of the MicroController used.

Connect the Usbasp hardware to the PC.The target IC Atmega16 is placed on the bread board and the ISP pins are connected to the respective pins of Usbasp (for details go here) .

Fire up Avrpal.Net  and click on the black rectangle window.Now the software recognizes the type of target Avr IC and displays it (ATmega16 in our case).

Image 1

Click on the browse ellipses next to Select File and locate the .hex file created through Atmel Studio6.Click the Write to chip button.You can see the avrdude in action writing the file on to the target.

The software also incorporates a Fuse calculator & editor.Click on Fuse editor & select the refresh button to confirm the chip name as Atmega16.Lfuse & Hfuse bits are displayed.You can change the Fuse bits as per your needs.Remember , a tick mark  means it is “1” & NOT programmed (disabled) & no tick mark means “0” & programmed (enabled).

 

Image 2

Image 12

The final HEX values are displayed as per your fuse bit settings.If you want you can provide a shortcut name and save it for future use.Now you can return back to main window to click “Write Fuses”.

Near to Fuse editor button there is a check button for “Set slow SCK”.This should be checked if you are using the Atmega16 IC in default mode of 1Mhz internal clock .

 

ExtremeBurner-AVR

 

Image 2

Extreme Burner has full graphical user interface (GUI) and can be used much more easily to Read/Write Fuse Bytes & Chip content.This is an excellent program written by Mr.Avinash Gupta of Extreme Electronics.

Download it from :

http://extremeelectronics.co.in/software/BurnerAVR/eXtremeBurnerAVRSetupV1.2.exe

Open up the software.Under Settings –> Programming Mode select ISP.

Under Chip –> Select the target IC (ATmega16).

Now click on Open button and browse to the location of the .Hex file & select it.

Hex file Loaded successfully message gets displayed.

Click the Write All button (marked as a Down arrow icon) to start the burning process.

Image 4

A separate Usbasp driver installation is not required ,as the Extreme burner includes within its installation.

A Fuse calculator &Editor is also incorporated.Click on Fuse Bits/Settings tag to open up the Fuse editor.Low Fuse & High Fuse default values are displayed.You can click on the Bit Details button if you need to change the Fuse bits.Just Double click on the Fuse bit to be changed to make it Programmed or Not.

Image 5

 

Image 10

In the Fuse Bits setting window there is a “Configure AVR Clock” button through which you can easily set the Clock frequency.

Image 9

 

AVR8-Burn-O-Mat

AVR8 Burn-O-Mat is a cross-platform GUI for avrdude written in Java.
It simplifies programing and configuration of AVR microcontrollers with easy to use dialogs.

The program is written in Java so you need the Java SE Runtime Environment (JRE).

Image 3

 

Image 4

Download the Windows Installer from

http://avr8-burn-o-mat.aaabbb.de/avr8_burn_o_mat_avrdude_gui_en.html

This program needs the Java SE Runtime Environment (JRE). You can download it here: http://java.sun.com/javase/downloads/index.jsp.

You need to install Win AVR  to use this.

First you should take a look at the settings. Make sure that the path to avrdude program and the avrdude configuration file is correct.

Click Setting –> AVRdude.In the new window that  appears , Locate the avrdude.exe from your installed drive by clicking ‘file’ button.

In our case  AVRDUDE location is   C:\WinAVR-20071221\bin\avrdude.exe

and then locate the configuration file in similar fashion.(The supported programmers are read from the file avrdude.conf).

Select the Programmer type “usbasp” and “USB” as port. Uncheck all the rest options and click apply. Your software is ready to use now.

 

SinaProg

           SinaProg  is a burner software with simple user interface.It also incorporates an AVR Fuse calculator.

It uses  improved AVRDUDE 5.10 & supports new devices &   new programmers.It  lists only the available ports  &  baud rate selection is possible.
              

Image 5

Download it from:

http://rapidshare.com/files/357579060/SinaProg.zip

It is a standalone simple software & no installation is required.First select the device type as ATmega16 & set the Programmer to USBasp & port to USB (as seen at the bottom of window).Click on browse under Hex File and locate the .Hex file to burn.Then click Program button under Flash.Fuse bits can also be programmed .

Click on Advanced button under Fuses.

Image 11

Change the Hex values of Fuse bits & click Write to program the Fuse bits.

 

In this post we shall see how to use Atmel Studio6 for creating a new project.Compared to WinAvr this is a huge download.But once installed you’ll appreciate the tools incorporated and the programming wizard is a breeze for AVR program development.

Previously it was called AVR studio.ATMEL Studio 6 is same as its predecessor  AVR Studio5 but for the improved toolchain for developing programs for ARM chips and also includes a QTouch Composer for touch application development .So they call it as a single Studio for 2 Architectures ARM & AVR.

Visual Studio 2010 should be installed prior to Atmel Studio 6.Even if you do not have Visual studio installed in your PC, the installation wizard recognizes this and starts the Visual Studio 2010 installation prior to the actual Atmel Studio.

Watch this video of Studio6 installation :

 

ATMEL STUDIO 6

 

Here are the actual screenshots of the installation procedure:

 

1.AtmelStudio6  installer checks for the installation of VisualStudio 2010 in your PC

    Image 1                      Image 2 

2. If VisualStudio2010 is not found then the installer starts the VisualStudio2010 shell setup prior to the actual Atmel Studio setup.

     Follow the wizard and accept the terms and conditions.

 

Image 3             Image 4

 

3. Select the  “Full “ configuration of setup.

Image 5 

 

  4. VisualStudio2010 shell setup process starts to install all required tools 

  Image 6  

 

 

     Image 7  

 

5.Now the installer starts the installation of AtmelUSB

    Image 8

 

6. Click install .

Image 9         Image 10

 

7. As soon as the driver software is installed click Finish.

Image 11    Image 12

8. Now the actual ATMELStudio6 installation wizard starts.

 Image 15         Image 16

 

 

Image 17      Image 18

 

9.Go by the wizard till you get the Finish window.

Image 19

10. Now go to All Programs  & under Atmel double click AtmelStudio6.0

Image7.7

11. Now you may get this error window and Studio may close.

Image 20   

12. You have to download the Service Pack 1 by clicking the “ here “ link inside the window.

It is a 300Mb download again (…..hmmm)     

      Image 21

13. You can install the Service pack online.If your broadband speed is good , you can complete the installation within 10 minutes.

You can also download the standalone .iso file for installation.But it is a huge 1.5Gb download.

Image 22 

 Image 23            Image 24

 

Once the service pack is installed successfully you can go ahead with ATMELStudio 6 usage.

 

AVRdude is bundled with WinAVR compiler and is a command line program for burning hex code into AVR ICs.

Before starting the Avrdude , connect the Usbasp programmer to your PC.

Press WIN+R  to open up the Run dialog box.Type cmd.exe to open the Terminal window.Navigate to the folder where we created our .Hex & other files.In our case it is C:\LED_TEST.

dude1

Type C:\LED_TEST>avrdude

to view the list of options used with avrdude.

-c : Indicates the programmer type (use usbasp as argument)

-p : Processor. (We are using ATmega16, hence type m16 as argument ).

-U  :  memtype:op:filename[:format]

-U is the command to fuse .hex file on to AVR’s memory. Multiple ‘-U’ options can be specified in order to operate on multiple memories on the same command-line .

Here is the command we use to program our blinkled.hex file.

Take care of casing of letters (small or capital letter), as the command is case sensitive.

C:\LED_TEST> avrdude –c usbasp –p m16 –u –U flash:w:blinkled.hex

Watch this video :

AVRDUDE

 

Before reading this post , be aware that playing with fuse settings may render your AVR chip dead or useless.Take care before setting any of the fuse bits.Fuse programming is most crucial and any mistake might lead to non-functioning AVR controller.

There are 3 bytes of Resettable Fuses that you may change as many times as you’d like.

HFuse ,LFuse & EFuse   (High Byte,Low Byte & Extended Fuses)

Apart from this there are 6  Lock bits in ATMega16/32 which are fuses that can be used to lock down the chip.Memory lock features can be set using these lock bits & also further programming of Flash & EEPROM can be disabled.

By default ATmega16/32 AVR chips are factory set as

Hfuse   0×99  (b 10011001)
Lfuse    0xE1  (b 11100001)

H fuse:  JTAG ( Enabled ), OCD ( Disabled) ,SPI Programming( Enabled),          CKOPT (Unprogrammed ), EEPROM Preserve( Unprogrammed )
BOOT size       : 1024 words &  Reset Vector    : User flash code

L fuse:  Brown-out level : 2.7V  ,Brown-out detect: Disabled
Startup timing  : Default ,Clock Source   : Internal, 1MHz

Setting AVR fuse bits correctly is most important and equally confusing part for many beginners.Remember that if fuse bits are incorrectly programmed it may cause to brick the IC .

Take a look at this table of Fuse Bits of ATMega 16/32fuse3

Low Fuse

Bit 7  BODLEVEL   Brown out detector trigger level (1 unprogrammed)

Bit 6
BODEN  Brown out detector enable 1 (unprogrammed, no BOD)

Bit 5
SUT1   Select start-up time 1 (unprogrammed)

Bit 4   SUT0  Select start-up time 0 (programmed)

Bit 3  CKSEL3  Select Clock source  0 (programmed)

Bit 2  CKSEL2  Select Clock source 0 (programmed)

Bit 1 CKSEL1 Select Clock source 0 (programmed)

Bit 0 CKSEL0  Select Clock source 1 (unprogrammed)

High Fuse

Bit 7  OCDEN On Chip Debugging Enable 1 (unprogrammed)

Bit 6  JTAGEN  Joint Test Action Group Enable 1 (unprogrammed)

Bit 5  SPIEN Enable Serial Program and Data Downloading 0 (programmed)

Bit 4  CKOPT Clock Oscillator options 1 (unprogrammed)

Bit 3 EESAVE  EEPROM memory is preserved through the Chip Erase
                            1 (unprogrammed, EEPROM not preserved)

Bit 2  BOOTSZ1  Select Boot Size 0 (programmed)

Bit 1  BOOTSZ0 Select Boot Size 0 (programmed)

Bit 0 BOOTRST Select Reset Vector 1 (unprogrammed)

 

The datasheet for each microcontroller contains detailed information on the fuse bits available and their function. Setting  a “1” in a bit means it is unprogrammed while having a “0” is considered to be programmed. Do not get confused by the notation used.As per ATMEL design “0” means programmed.

There are different clock source in AVR. You can choose one by setting or clearing any of the LFuse bits CKSEL0 to CKSEL3.

The mostly widely used option is to connect the crystal oscillator. In this mode CKOPT IS programmed (write its bit value 1 to 0).Then OSC generates full rail to rail output swing.If it is left at 1, then it has limited frequency swing.

ATMega 16 by default runs at 1MHz internal oscillator.But generally you use an external crystal of 8MHz across pins 12 & 13 .Note that ATMega 16L can work at a maximum  of 8MHz crystal.So do not use a 16MHz crystal for L series IC. 16MHz crystal works for ATMega 16A or ATMega16 plain.

To set the IC to work with an external crystal you have to set the Low & High Fuses as

HFuse 0xC9    OCDEN disabled,JTAG disabled, CKOPT programmed to high swing osc.

LFuse  0xFF  set all bits as 1 ie., unprogrammed.

If you set the fuse bit for using external clock and forget to use a crystal between pins 12 & 13 ,then AVR IC is not going to oscillate.It behaves as dead till you connect a crystal externally. 

ATMega16 consists one JTAG port which shares 4 pins of PORTC. If you complain that PORTC pins do not work properly then JTAG should be disabled.

JTAG port should be disabled if you want these pins to be used as normal IO pins (PC2,PC3,PC4 &PC5).

To permanently disable JTAG configure the 2 HIGH fuse bits  OCDEN (bit7) & JTAGEN (bit6).These 2 bits are to be set as 1.

So Hfuse will be 0XC9 against the default 0x99.

For setting the fuses ,you can use the free on line Fuse calculator from

http://www.engbedded.com/fusecalc/

engbed

 

We will see how to feed this Fuse settings in the upcoming post of Burner softwares for AVR.

AVRpal.Net ,Extreme burner , Sinaprog are some of the well known burner softwares.

To set the fuses manually you can start the command line program “avrdude” .

Type Run –> cmd.exe to open up the command window.

Your usbasp device should be connected to PC before starting the Avrdude.

Type C:\avrdude –p m16 –c usbasp –t

p is the part name which is Atmega16 in our case. So type “–p m16 “

c is the programmer type which is “usbasp”

is used to enter in AvrDude’s interactive window .

avrdude > d lfuse     –> returns the values of low fuse byte

avrdude > d hfuse    -> returns the value of high fuse byte

avrdude > w hfuse 0xC9  –> to write hex C9 in high fuse byte

Type Quit to terminate window. 

For more details on command line programming see tutorial 4 post.

Watch this video on FUSE settings :

AVR FUSE Setting Guide

 

In tutorial 2 we created ledtest.c  file using the IDE of Programmers Notepad & also we created a Make file (go to tutorial 2 here ).

We’ve saved these 2 files inside C:\LED_TEST folder.

In this post we shall see the ways of generating the .Hex file and burning it on to the target AVR chip ATMega16.

From under WINAVR fire up Programmers Notepad.

Go to File –> Open & browse to C:\LED_TEST to select the ledblink.c program we created in previous post.

Imagepn3

Click  Tools –> Make All

to start the compilation.Programmers notepad will compile,link and generates the .Hex file of your .c file.

Imagepn 7

After successful compilation you can see “>Process Exit Code : 0 “ at the bottom of the Output window.

You can see a list of compiled files generated within your project folder C:\LED_TEST.

A file with extension .hex  (blin_led.hex) is the one we are going to burn on the target IC.

Imagepn 8

Now click  “ Program “  under Tools

Imagepn 6

You can see in the Output window the AvrDude in action writing the .hex file on to your chip.While the .hex file is being written , the Red LED glows on the usbasp hardware.

Watch this video :

Creating & Burning .hex file on to AVR chip

 

In this post I shall demonstrate the usage of Programmers Notepad ,as an IDE to create programs and burn  on the target IC.Also ,the creation of Make file will be explained.

These two programs are installed by default along with WINAVR tool chain installation.(Learn to install WINAVR tool chain here ) The  Programmers Notepad (PN) acts as an Integrated Development Environment (IDE) where you write your C code,compile it (called “Make All”) & burn it on to the target AVR chip.

A MAKE file tells the compiler what commands to run, what files to compile and link, the sort of output to create, and can also do other things such as programming the chip.

Makefiles have the name Makefile without any extension , and are processed by a program called make. WINAVR has a tool called MFILE (with a magic lamp Icon).It makes life easier , creating the Make file.As they do not have an extension ,make file can not be open by any default program.You can use Notepad to open it.

PN

Keep in handy these items before starting the actual programming :

AVR Dude programmer, a Breadboard, ,Jumper Wires,LEDs,

ATMega16 AVR IC, 6PIN RMC wire with Berg pins

Picture 42

Place the 40 pin AVR IC on breadboard and connect the AVRDude to the ISP pins of AVR Ic starting from pin6 to  pin 11.The AVR chip will source its power from the USB connector itself.No separate power supply is required.

Every AVR IC has a set of 6 pins used for In System Programming (ISP),by which you can load your .hex file on to the Target IC without removing the IC from the existing Circuit.

 

Picture 45Image 1

Fig1. Actual Hardware Setup                     Fig2. Connection between ISP header & AVR pins

Connect these six pins (MOSI,MISO,SCK,RESET,VCC & GND) to the respective pins of header of UsbDude as seen above in Fig2. As you cannot use the 10 pin header on the breadboard, use a 6 pin RMC wire to connect .Connect 2 LEDs ,one at Pin22 (PortC 0) & another at Pin23 (PortC 1) through a 330E current limiting resistor.

Plug in the six pin RMC wire from AVR Dude to the respective pins of AVR IC (pins 6 through 11).Connect the AVRDude to the PC using A-B USB wire.If the driver for USBASP is already installed (if not download it here),Windows recognizes the hardware .

To start programming ,create an empty folder in your C: drive ,say LED_TEST.In this folder we shall store all our programs for this project.

Open up Programmers Notepad & from the drop down where you see “ Plain Text “ select C/C++ .This enables Syntax highlighting while writing your C code.

 

PN1

Type in the following code :

#include <avr/io.h>  // header file that enables AVR peripherals
#include <util/delay.h>  // header file to use time delay

int main (void)                //main program starts here
{
  DDRC = 0b0000011;  /* declaring Data Direction Register C ,pin0 & pin1 

                                         as Output pins , 1 is for Output & 0 for Input */
  while(1)                         //Never ending loop starts here
  {
 
  PORTC = 0b00000011;  /* PORTC pins 0 & 1 are made HIGH to make  

                                            LEDs glow      */
   _delay_ms(500);            // 500 milli sec delay
  PORTC = 0b00000000; // PORTC  pins 0 & 1 made LOW
  _delay_ms(500);             // LEDs off for 500 millisec
 
  }

}

Click File & Save As  blink_led.c  inside the folder you created in C: drive. Do not forget to save the file with extension .c

Now fire up the MFile program

make_11

Select from Menu  Makefile & make following settings :

MCU type –> ATMega –> ATMega16 (the AVR IC we are using)

Output format –> ihex

Port –> usb

Programmer –> under this we have to select “usbasp” .But it is not in the list.Select any one from the list,say STK500V2 ,and then click “Enable Editing of Makefile”.

Now you can edit the yellow highlighted statement to usbasp

 

 make_usb

Before saving the mfile ,you have to include your Program name in the Makefile.Scroll down the Make file to locate “TARGET = main “ and change this to

TARGET = blink_led    

blink_led is the name of the C file we created earlier.Do not include the .c extension here.

make_main

 

Save this Makefile inside the LED_TEST folder we created.As the Makefile does not have an extension , we cannot assign a default program to open it.However,Notepad can be used to open it.

Watch this support video for this session :

WINAVR–Programmers Notepad & MakeFile

 

For further details contact :

cooltext753793315   cooltext753795865

 

cooltext753472145

This AVR tutorial series aims to make you comfortable programming the  AVR Microcontroller chips .

Before we meet the actual hardware components ,it is a must to learn about the software tools that make programming a breeze.

For Windows platform WINAVR  is the most widely used compiler toolchain as it is Open source & supported by numerous online forums.This tutorial focuses on setting up this development environment.

There are other programs like CodeVision AVR,Image Craft AVR & BASCOM AVR.But these are commercial ones and offered with a hefty price tag.

We shall settle down with WinAvr and start with download WINAVR2010 from

http://sourceforge.net/projects/winavr/files/WinAVR/20100110/WinAVR-20100110-install.exe/download

As the server at sourceforge.net has a limited bandwith, the download takes some time ,though it is a 28Mb file. 

Install the downloaded WinAvr software tools.Under All Programs you can see the installed components :

Image 2

WINAVR comprises of following tools :

A GNU GCC Compiler to convert your C code into .Hex file

A compiler library called avr-libc

MFile which is a Make file creator, which tells the compiler what commands to     run,what files to compile & link,what programmer to use,etc.,

A programming software , avrdude ,to fuse your .hex file on to the target AVR chip

A Programmer Notepad where you type in your C code & few others.

Instead of avrdude you can use the AVR STUDIO as a Visual designer platform.This can be used as an IDE with WINAVR as a plug-in.Now AVR STUDIO is called ATMEL STUDIO 6 (a bulky download of 850MB).In future videos we shall make use of this, as it is more powerful with Simulator,Intellisense,etc.,

For better understanding of AVR programming you should start with WINAVR tools.

cooltext753477087 is an economical small hardware using Atmega8L IC ,clocked by a 12.00Mhz crystal & loaded with firmware to burn your .hex files on to the target AVR chip.Programming speed is up to 5kBytes/sec.

USBASP is a well known USB programmer for Atmel AVR microcontroller & it is officially included and supported in WinAVR (now version 20100110  ).

 

usbdude    Usbasp is also called as AVR-Dude by the name of the programming software itself.

Download the drivers for UsbAsp from

http://www.protostack.com/download/USBasp-win-driver-x86-x64-ia64-v1.2.4.zip

Connect the UsbAsp hardware to your PC or Laptop using the A-B Usb cable.Windows informs that a new hardware was found and demands for the drivers.Open up the Device manager and right click Usbasp and browse to the folder where you downloaded the driver.Click Next to install the driver.

Now in Device manager you can see Usbasp hardware recognized.

Watch this 1 st video of WinAvr & Usbasp installation procedure :

 

AVR Programming : 1.WinAVR & Usbasp Installation

 

For further details contact :

cooltext753793315   cooltext753790696