LeoStar
Member level 2

Hey there champions,
I am back with another jug of problems.
I have just started working on AVR Atmega16 microcontroller.
And I am using Atmel Studio 6.
I am very well familiar with the programming of PIC microcontroller on Microchip.
And i find it quite easy to build.
But i tried to program AVR in the same way of building logic as that of PIC and I it didn't work.
Here is the code that I tried.
PURPOSE OF CODE:
To on an LED with a Button for ten seconds
Here is the group of instructions that I wrote considering it complete code:
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
When I tried it on proteus, nothing happens no matter how many times i press the button.
Plus there is an error of internal exception on proteus and it crashes.
Any help would be greatly appreciated. It is urgent for me.
So please someone look for it.
Eagerly waiting for the reply.
Thanks in advance.
I am back with another jug of problems.
I have just started working on AVR Atmega16 microcontroller.
And I am using Atmel Studio 6.
I am very well familiar with the programming of PIC microcontroller on Microchip.
And i find it quite easy to build.
But i tried to program AVR in the same way of building logic as that of PIC and I it didn't work.
Here is the code that I tried.
PURPOSE OF CODE:
To on an LED with a Button for ten seconds
Here is the group of instructions that I wrote considering it complete code:
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
Code:
#include<avr/io.h>
#include<util/delay.h>
#define SW1 PA0
#define LED1 PA1
void main()
{
DDRA=0xFE;
PORTA=0x01;
LED1<<0;
while(1)
{
if(sW1==0)
{
LED1<<1;
_delay_ms(10000);
}
else
{
LED1<<0;
}
}
}
When I tried it on proteus, nothing happens no matter how many times i press the button.
Plus there is an error of internal exception on proteus and it crashes.
Any help would be greatly appreciated. It is urgent for me.
So please someone look for it.
Eagerly waiting for the reply.
Thanks in advance.
Last edited by a moderator: