Please follow these steps to Install applications needed to work on AVR.
Step 1: Install WinAVR-20100110-install.exe
Step 2: Install LVRTE2010min.exe
Restart Computer
Open Programmers Notepad:
Start Menu> All Programs> WinAVR 20100110> Prgrammers Notepad
1) Write your code here
2) Save the file with .c extension(say led.c) in a new folder(e.g first program )
Open Mfile[WinAVR]
Start Menu> All Programs> WinAVR 20100110>Mfile[WinAVR]
1) Click on Makefile>Make file name
Enter name of the source file name(led)but without any extension.
2) Click on Makefile>MCU type> select your microcontroller from the list (eg. atmega 16)
3) Click on Save as and save the file in the same folder(first program)with the name "Makefile".
Step 3: Again go to Programmers Notepad .
1)File>Open>locate the folder (first program)
2)Select Makefile and click on open.
3)Goto Tools and Click on MakeAll.
Note: On the output window you should get error code:0
Step 4: Open Sinaprog.exe And check following settings:
1)Under Programmer section, select STK500 v2 on first, HID on Second and Default on 3rd.
2)Under Hex file section, locate your folder and select .hex file and click ok.
3)Click on Program
----------------------------------------------------
Sample Code to Glow LED.
Note: LED Connected On PortB 0th Pin
----------------------------------------------------
Code:
#include avr/io.h
#include<util/delay.h>
#include<compat/deprecated.h>
int main(void)
{
DDRB=0b00000001;//PORTB0 Declared as Output Pin
while(1)
{
sbi(PORTB,0);//Make PORTB0 PIN HIGH(5V Logic)
_delay_ms(1000);//delay
cbi(PORTB,0);//Make PORTB0 PIN LOW (0V LOGIC)
_delay_ms(1000);//delay
}
}
