Parallel Port Programmer for ATmega8 is a simple circuit that can be made at home. Parallel Port Programmer Circuit is as shown below.
Circuit Diagram
Components Required
9V Battery - 1
7805 Voltage Regulator - 1
ATmega8 - 1
DB-25 Female - 1
Crystal Oscillator 4MHz - 1
Resistor 10K - 1
Resistor 1K - 8
Capacitor 27pF - 2
Capacitor 10uf - 1
Capacitor 1 uf - 1
Softwares To Be Installed
1. avr-libc
2. binutils-avr
3. avrdude
4. gcc
5. gcc-avr
6. uisp
Software Installation
Now open your terminal and execute the following commands to install the softwares.
sudo apt-get install avr-libc binutils-avr avrdude gcc gcc-avr
sudo apt-get install uisp
Now create your first program.
Execute the following command to create the program file.
nano first.c
Now copy the following code to this file.
#include <avr/io.h>
#include <util/delay.h>
void sleep(uint8_t millisec)
{
while(millisec)
{
_delay_ms(1);/* 1 ms delay */
millisec--;
}
}
int main()
{
DDRC |=0b11111111; //Declare PORT C as an output
while(1)
{
PORTC |=0b11111111;
PORTC &=0b00000000; //turn off PORT C
sleep(1000);
PORTC |=0b11111111;
PORTC &=0b11111111; //turn on PORT C
sleep(1000);
}
return 1;
}
Next is to save the file. Press CTRL + O to save the file. Now exit from the file. Press CTRL + X to exit from the file.
Next is to compile the code. Execute the following command to compile the code. Compiling will generate an object file.
avr-gcc -mmcu=atmega8 first.c -o first
Now generate the hex file from the object file. Execute the following command to generate the hex file.
avr-objcopy -O ihex first first.hex
Now upload the hex file to your microcontroller using the following command. Before executing the following command connect the programmer circuit to your parallel port.
Execute the following command to create the program file.
nano first.c
Now copy the following code to this file.
#include <avr/io.h>
#include <util/delay.h>
void sleep(uint8_t millisec)
{
while(millisec)
{
_delay_ms(1);/* 1 ms delay */
millisec--;
}
}
int main()
{
DDRC |=0b11111111; //Declare PORT C as an output
while(1)
{
PORTC |=0b11111111;
PORTC &=0b00000000; //turn off PORT C
sleep(1000);
PORTC |=0b11111111;
PORTC &=0b11111111; //turn on PORT C
sleep(1000);
}
return 1;
}
Next is to save the file. Press CTRL + O to save the file. Now exit from the file. Press CTRL + X to exit from the file.
avr-gcc -mmcu=atmega8 first.c -o first
Now generate the hex file from the object file. Execute the following command to generate the hex file.
avr-objcopy -O ihex first first.hex
Now upload the hex file to your microcontroller using the following command. Before executing the following command connect the programmer circuit to your parallel port.
sudo uisp -dprog=dapa -dpart=ATmega8 if=first.hex -dlpt=0x378 --erase --upload
This comment has been removed by the author.
ReplyDeleteBrowse the best mobile phone blogs online, know about invention of mobile phones, history, technical information, technology used, and all about phones you should know.Visit our website and Explore Now!
ReplyDeleteInvention Of Mobile Phone