how to program microcontroller

to know how we do exactly transfer the program to microcontroller we can follow following diagram

complier assembler linker

c code(.c file) -----------------> assembly code(.asm file) ------------------> object file(.obj file) ---------------->executable file(.exe,.elf,.hex)

converts to converts to links library

In our case above procedure id followed.

we use GCC complier that has assembler and linker .

AVRDUDE can be used effectively via the command line to read or write all chip memory types (eeprom, flash, fuse bits, lock bits, signature bytes) or via an interactive (terminal) mode. Using AVRDUDE from the command line works well for programming the entire memory of the chip from the contents of a file, while interactive mode is useful for exploring memory contents, modifying individual

bytes of eeprom, programming fuse/lock bits, etc. AVRDUDE supports two basic programmer types: Atmel's STK500 and the PPI (parallel port interface). PPI represents a class of simple programmers where the programming lines are directly connected to the PC parallel port, while the STK500 uses the serial port to communicate with the PC and contains on-board logic to control the programming of the target device. Several pin configurations exist for the various PPI programmers that exist, and AVRDUDE can be be configured to work with them by either specifying the appropriate programmer

on the command line or by creating a new entry in its configuration file. All that's usually required for a new entry is to tell AVRDUDE which pins to use for each programming function.

Parallel port and Atmega16 connection

The simplest possible programmer is shown below and requires only a few

connections, a few resistors, and a crystal resonator assuming your device

doesn't have an on-board oscillator. If the device you wish to program has an

on-board oscillator, you can do without the crystal resonator. In it's simplest

form, just make the following connections from the parallel port pins to the Atmel

AVR device:

Parallel Port Programmer Function

Pin 7 AVR /RESET

Pin 8 AVR SCK (clock input)

Pin 9 AVR MOSI (instruction in)

Pin 10 AVR MISO (data out)

Pin 18 Signal Ground

connection to microcontroller can be done as :

Be sure and include series resistors between the signal wires and the parallel

port. 1K resistors should work fine and may save your parallel port from damage

in case of mis-wiring or some other mishap.

Also, of course, you need a power supply to power the chip. Some parallel ports

can source enough power for smaller chips, but I recommend creating a simple

battery supply and a voltage regulator (7805 or similar) to regulate the voltage at

5V or whatever your chip requires since many modern PCs and especially

laptops cannot source enough current to power the larger AVR chips.

_______________________________________________________________________________

This AVR programmer consists of in-circuit serial programmer .

This AVR programmer is compatible with a popular PonyProg software that shows you a status bar of the programming progress.

the circuit diagram is --