Saturday, June 6, 2009

PARALLEL PORT PROGRAMMER FOR ATMEGA 16/32


PARALLEL PORT PROGRAMMER FOR
ATMEGA 16/32

In-system programmer means we can design a programmer circuit using simple parallel port interfacing such that our controller can be directly burned with the program while in the designed system or circuit board.

Following pins of Atmega16 is used in programmer circuit-

Pin NO.

Description

6

MOSI (SPI Bus Master Output/Slave Input

7

MISO (SPI Bus Master Input/Slave Output)

8

SCK (SPI Bus Serial Clock)

9

Reset

10

Vcc

11

Ground

Table-Atmega16 Pins

• SCK – Port B, Pin 7

SCK: Master Clock output, Slave Clock input pin for SPI channel. When the SPI is enabled as a Slave, this pin is configured as an input regardless of the setting of DDB7.When the SPI is enabled as a Master; the data direction of this pin is controlled by DDB7. When the pin is forced by the SPI to be an input, the pull-up can still be controlled by the PORTB7 bit.

• MISO – Port B, Pin 6

MISO: Master Data input, Slave Data output pin for SPI channel. When the SPI is enabled as a Master, this pin is configured as an input regardless of the setting of DDB6. When the SPI is enabled as a Slave, the data direction of this pin is controlled by DDB6. When the pin is forced by the SPI to be an input, the pull-up can still be controlled by the PORTB6 bit.

• MOSI – Port B, Pin 5

MOSI: SPI Master Data output, Slave Data input for SPI channel. When the SPI is enabled as a Slave, this pin is configured as an input regardless of the setting of DDB5. When the SPI is enabled as a Master, the data direction of this pin is controlled by DDB5. When the pin is forced by the SPI to be an input, the pull-up can still be controlled by the PORTB5 bit.

• RESET-Pin 9

Reset Input. A low level on this pin for longer than the minimum pulse length will generate a reset, even if the clock is not running.

• VCC -Pin 10

Digital supply voltage(+5V).

•GND-Pin-11

Ground.

Parallel Port-

Parallel Port interfacing is the simplest method of interfacing. Parallel Port’s are standardized under the IEEE 1284 standard first released in 1994. It has data transfer speed up to 1Mbytes/sec. Parallel port is basically the 25 pin Female connector (DB-25) in the back side of the computer (Printer Port). It has 17 input lines for input port and 12 pins for output port. Out of the 25 pins most pins are Ground and there is data register (8 bit), control register (4 bit) and status register (5 bit).



Following Pins are used in parallel port-

Pin No.

Description

7,8,9

Data pins

10

Status pin

19

Ground

Table- Parallel Port Pins

Interfacing -

In programmer circuit pins of parallel port which are above described has to interface with pins of ATmega16 microcontroller which are responsible for in-system programming. The parallel port can be interfaced directly with microcontroller. To avoid reverse current we can use Schottkey diodes as safety precaution for pc motherboard.

Following pins of Parallel Port and ATmega16 are to be interfaced-

Parallel Port

Atmega16

Pin 7

Reset (Pin 9)

Pin 8

SCK (Pin8)

Pin 9

MOSI (Pin6)

Pin 10

MISO(Pin7)

Pin 19

Ground(Pin11)

Interface Connections


Fig-Circuit Diagram of ATmega16 Programmer


Fig. The Snapshot


SOFTWARES USED:

WinAVR– WinAVR is open source package in which we use two sub-programs

Programmers Notepad & Mfile.

Version- 2.0.8.718-basic

Creator- Simon Steele

Purpose- 1. To write code.

2. To compile coding.

3. To generate Hex Code.

4. To burn Hex code.

The next tutorial will make you aware with how to install and use WinAVR for compiling and burning the program.

For a very good Tutorial on AVR USB Programmer, follow this link:

http://www.embedautomation.com/lectureseries

Regards:

Aditya Sharma

(http://robozeal.blogspot.com)

31 comments:

karthik said...

hi i've build the circuit exactly... i've checked the connections.... everything seems to be alright.... but when i do the prob test after connecting the programmer to the printer port it says test failed.... any suggestions???

i also ignored the msg nd proceed with writing the program but it says device missing... error code -24.... any suggestions.... i'm using pony prog....

heloitsadi said...

Pony prog is a serial device programmer it will not work with this parallel port circuit. Why don't you use WInAVR. I have posted a detailed tutorial on this as well and that will surely work.

amirjah said...

do you have anything on serial port programmer for atmega32?..i've tried pony prog but still can't do it..i've been looking for that type of programmer and your explanation is easier to understand and to follow the steps to program the avr..hopefully u can post it...
and one more thing..what's the different using parallel or serial?..or it's just simply a methods that we can choose?..which is easier?..thanks in advance

heloitsadi said...

If you are a beginner i will prefer that you should go for the Parallel port programmer, you can just design the circuit on the breadboard and it will do.

You can go for the serial port programmer through USB about which i have already provided the link in the post. It will work with Ponyprog.

Serial and Parallel port ones are both better in there own applications, the USB is the latest technology we use for serial comm. Parallel ports are obsolete and even latest desktop computers didn't provide parallel port interface.

Etienne said...

Tell me please how to connect the Schottkey diodes in the circuit. A Schottkey with 5V and 1A is good? Should I use these diodes for all five connections between the parallel port and the controller?

Thanks in advance

heloitsadi said...

Connect the diodes in reverse biased to the PC parallel port. Connecting to MISO and MOSI and pins will be enough.

Etienne said...

Can I use Avrstudio for parallel programming the uc?

heloitsadi said...

Actually their are various kinds of programmers and the one given here in this post is "bsd programmer". AVRStudio does not support programming through this device. You may look out for other programmers in STK series which are parallel port programmers and are supported by AVRStudio.

Etienne said...

Hello again,

I wrote a program using programmer's notepad(from WinAvr) and I made the makefile, but now I don't know how to compile the program to run it with AVR Insight. And then I would ask you how to burn it to the microcontroller(via parallel port of course). And how do i generate the hex code after compiling?

Thanks in advance,
Etienne

Etienne said...

Hi,

I think it works. I made an error in configuring the makefile. I compiled the program with Tools->[WinAVR]Make All and it generates some files with .hex, .o, .elf, .eep etc. To burn the uc i have to use Tools->[WinAVR]Program? It will automatically load the hex file in the uc? And how to use Insight? I can use it only after burning the uc?

Thank you,
Etienne

heloitsadi said...

Sorry for the late reply..

I have not mentioned anywhere to use AVR Insignt.. not getting exactly what your doubt is..
If you have successfully generated the hex file and installed the software exactly as mentioned in the tutorial, the code must be burned directly by the Programmers Notepad only.. Make sure that you have saved the makefile in the folder where your other files are. Do elaborate your further queries

Unknown said...

sir
i an a bigner in this field i want your guid lines .i want know which book i have to use?

heloitsadi said...

Their no specific books for learning all these, If you are a beginner you can refer to "Mazidi"-Its a good book for 8051 family of microcontrollers. Otherwise net is the best place to learn.

herbs said...

In computers, ports are used mainly for two reasons: Device control and communication. We can program PC's Parallel ports for both. Parallel ports are mainly meant for connecting the printer to the PC. But we can program this port for many more applications beyond that.

Anonymous said...

hello
my pc doesn't hav parallel or serial port..
the how program the MCU

pls reply
at feelpavan@yahoo.co.in

heloitsadi said...

You can make a USB programmer give at this link..
http://www.fischl.de/usbasp/

Anonymous said...

Hii Aditya Sharma.
Can you help me to control printer dot matrix use ATmega16 with program C??
can you help me.... please... :((

amod said...

hey can u help me in interfacing matlab to atmega16..i want to send some data to atmega16...

heloitsadi said...

@ amod

You can user the serial port to interface the Atmega16 (USART port). Look for serial port control through MATLAB. Revert back if further assistance needed.

Codename25 said...

Hi,

I have an line follower circuit of ATmega16,But,I am little confused about it..I don't know what the symbol that i have marked on the circuit dig means (circuit dig url is posted at the bottom)Whether its an parallel port programmer or USB???If it is a parallel port programmer,How will be the connection to DB25???What should i do with the pins 3,6,8,10 which is grounded,Should i simply leave it using only 7,9,1,5,2 pins for DB25???Please reply..

Thank you!


URL to circuit dig :http://www.playback2.sixserve.com/Download/untitled.JPG

Anonymous said...

hi...i few doubts abt this circuit...should we compulsory use schoottky diodes and i'm using windows7 actually i'm unable to install completely regarding running cms in the cmd.exe window...please reply me sir

Unknown said...

hi,
i m using winavr programmer.
to makefile which programmer should we consider is it stk200...
also while burning as per ur connection..
it shows error , even though its
hex is created error free.
plz help...

shekar said...

hai
this is shekar from hyd
i didd my mini project hardware part completed
while compling program i winavr
getting errors iam attachig progm
plz send it to my mail by making necessary corrections my mai is shekark1409@google.com

source program:
Robit.c
#include
void main(void)
{
unsigned int k,h;
DDRA=0x00;
DDRD=0XFF;
while (1)
{
k=PINA;
h=k & 0x0f;
switch (h)
{
case 0x02: //if I/P is 0x02
{
PORTD=0x89; //O/P 0x89 ie output one
break;
}
case 0x08: //if I/P is 0x08
{
PORTD=0x86; //O/P 0x86 ie output two
break;
}
case 0x04:
{
PORTD=0x85; //O/P 0x85 output three
break;
}
case 0x06:
{
PORTD=0x8A; //O/P 0x8A output four
break;
}
case 0x05:
{
PORTD=0x00; // STOP
break;
}
}
}
}

Certification Hub said...

sir i have .hex file with me. i downloaded form internet for gsm controlled robot.
i did parallel port connection as u said in breadboard.
i connected to pc.
but i can't burn the hex file into my atmega16.
how do i do this plz help me.
i tried almost all programming softwares..
and even serial port connection that also dint workout.

how do i know that uc is connected wen i connect in parllel port?
i don know what mistake i have exactly made..

Dhiyagu said...

Will you please send me a circuit for usb interfacing

Mail me @ sridardhiyagu@gmail.com

Sara said...

This was brilliant stuff! Thanks for the write up! You can Download any laserjet drivers from HP LaserJet p1102 here!

RAMDAS said...

Hi frnd....i m a b.tech.2nd year student(ece). i m interested in robotics .i hv some knowedge about basic robotics(made:-power supply,automatic street light etc.)& microcontroller atmega8,ATMEGA16( made:-development board,working on line follower )....but i want advance knowledge in robotics field .so i want summer course(may,june)for advance robotics,circuit design,embeded system...PLZ guide me &tell some institutes name which are offering
summer course..
plz send information on my id
e-mail: ram.singathiya@gmail.com

Anonymous said...

Ram das where you live first tell, so I let you know that which ins is gud for you.
info@projectsmaker.com

Anonymous said...

can v use it for atmega8 also?

Unknown said...

hi
I have made an Arduino severino S3V3 as given in this site http://arduino.cc/en/Main/ArduinoBoardSerialSingleSided3.But the problem here is a iam able to burn the bootloader to the uc through isp on the severino via usbasp but the bootloader gets erased after the power is disconnected soon after some seconds.The programs run fine. i upload the programs using arduino IDE but if i remove the power after burning the bootloader and uploading program, it gets erased and doesnt run the uploaded program and i have to burn the bootloader again. Bootloader file - arduino-1.0.3\hardware\arduino\bootloaders\atmega folder (ATmegaBOOT_168_diecimila). i use USBasp programmer and avrdude for burning the programs.
The code i used to burn the bootloader is
avrdude -c usbasp -p m168 -u -U flash:w:ATmegaBOOT_168_diecimila.hex
Please help me out...

Unknown said...

I wish to drive circuit through matlab making the same connection through parallel port using Atmega16. Will it be possible? please suggest me what shall I do?