First I think, how to build a USBasp programmer.But I have n't a usb programmer to flash the firmware to it. Then decided to create a serial programmer and flash the firmware through this programmer to atmega8. My AVR serial programmer will transform hex file to most AVR microcontroller. It can build using few readily available components. This programmer is compatible with popular avrdude software or PonyProg software.
We will be using the serial port for burning. First, we have to develop a burning circuit for it.
REQUIRED COMPONENTS
Resistors : 10k - 2
4.7k - 2
15k - 1
Zener diode : 5.1v - 2
Diode : 1N4148 - 1
Transistor : BC549/48 - 1
9-PIN RS232 female connector
 |
| serial programmer |
This program copy anything to anything.Since the input and output can be redirected to any file or device.
We can write a simple program to copy its input to output.we use low level I/O read and write system calls.we have collected function prototypes for the system calls into a file called syscalls.h.so we can include it in this program.but the name syscalls.h is not standard.In UNIX system "unistd.h" is used instead of "syscalls.h".The program code is below:
The parameter BUFSIZ is defined in "stdio.h"; Its value is good size for the local system. if the file size is not a multiple of BUFSIZ, some read will return a smaller number of bytes to be written by write; the next call to read after that will return zero.