ATMEGA 8535 LINE FOLLOWER PROGRAM

#include<avr/io.h>

int main(void)
{
DDRA=0X00;
PORTA=0X00;

DDRD=0XF0;
PORTD=0X00;

while(1)
{
if((PINA&0X01)==0X01)
{
PORTD=0X10;
}
else if((PINA&0X02)==0X02)
{
PORTD=0x40;
}
else if((PINA&0X03)==0X03)
{
PORTD=0X50;
}
else if(((PINA&0X03)==0X03)&&(PINA&0X01)==0X01)))
{
PORTD=0X40;
}
else if(((PINA&0X03)==0X03)&&((PINA&0X01)==0X01))&&((PINA&0X02)==0X02)))
{
PORTD=0X40;
}
else if(((PINA&0X03)==0X03)&&((PINA&0X02)==0X02)))
{
PORTD=0X50;
}
else
{
PORTD=0XA0;
if((PINA&0X02)==0X02)
{
PORTD=0x10;
}
}
}
}

 

AUTHOR :SARANKUMAR M R

About these ads

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s