You are on page 1of 1

#include<stdio.

h>
#include<avr/io.h>
#include<util/delay.h>
#define F_CPU 1000000UL
void main()
{
DDRA = 0X00; // iNPUT PORT
DDRC=0XFF; // output port
while(1){
if((PINA & 0X80)== 0)
{
PORTC=0x09; //ACW-2 phase excitation
_delay_ms(4000);
PORTC=0x0c;
_delay_ms(4000);
PORTC=0x06;
_delay_ms(4000);
PORTC=0x03;
_delay_ms(4000);
}
else
{
PORTC=0x09; //ACW-2 phase excitation
_delay_ms(4000);
PORTC=0x03;
_delay_ms(4000);
PORTC=0x06;
_delay_ms(4000);
PORTC=0x0c;
_delay_ms(4000);
}
}
}

You might also like