Let’s start our journey with ATmel microcontroller. The Atmel®AVR® is a low-power CMOS 8-bit microcontroller based on the AVR RISC architecture. By executing powerful instructions in a single clock cycle, the ATmega achieves through puts approaching 1MIPS per MHz, allowing the system designer to optimize power consumption versus processing speed. ATmel has IDE(integrated development environment) platform to operate. Some IDEs
Our first program in WinAVR. Before building let’s talk about the looping functions-
One interesting things about do-while looping is that the executing will run ones if the test condition is false. In C programming the execution will run ones but in Embedded system the loop is for infinite time to execute the function given for the microcontroller. So there we need an infinite loop. In C programming
Use ATtiny45 Pin-> PB0 toggle in every 1s in WinAVR IDE and burner used USBasp. The main program as follow-
Write the program in Programmers Notepad[WinAVR] save as main.c. Open MFile[WinAVR] change only 2 parameter
Exploring Makefiles(Tools menu)
After write your code in Programmers Notepad[WinAVR] first make clean than make all to generate the hex file. Our target file is main.hex . Now it’s time to load the program in the AVR microcontroller.
AVR Burning Process
The program written in PC is send to MCU in a special technique is call Burning. Hardware needed for this process is called burner. There are three types of Burner
- Parallel port/ Printer port Burner
- Serial port Burner
- USB port Burner
We begin our journey with USB burner called USBasp burner. You can make your own burner.
USB programmer for Atmel AVR controller
USBasp is a USB in-circuit programmer for Atmel AVR controllers. It simply consists of an ATmega 4 or ATmega 8 or ATmega 88 and a couple of passive components. The programmer uses a firmware only USB driver, no special USB controller is needed. You can build your own burner using couple of components.
First download the firmware that is a hex file and burn ATmega8 or ATmega88 and connect according to the circuit. Lets burn the ATmega8 with either
Serial port Burner/
Parallel port Burner
Since in figure we have to use external crystal oscillator. We need to setup the fuse bit in proper configuration. Let’s looks at the fuse bits in ATmega8.
We previously build our first program of Toggle LED. We can see the real life simulation in PC using the software