#include
#include
#define s1 PINA.0
#define s2 PINA.1
#define s3 PINA.2
#define s4 PINA.3
#define ka1 PORTD.0
#define ka2 PORTD.1
#define ki1 PORTD.2
#define ki2 PORTD.3
#define kanan 1
#define kiri 0
#define maju 1
#define mundur 0
void dc(unsigned char motor,unsigned char arah,unsigned char pwm)
{ if(motor==kanan)
{ if(arah==maju)
{ ka1=1;
ka2=0;
}
else
{ ka1=0;
ka2=1;
}
pwm=OCR1A;
}
else
{ if(arah==maju)
{ ki1=1;
ki2=0;
}
else
{ ki1=0;
ki2=1;
}
pwm=OCR1B;
}
}
// Declare your global variables here
void main(void)
{
// Declare your local variables here
// Input/Output Ports initialization
// Port A initialization
// Func7=In Func6=In Func5=In Func4=In Func3=In Func2=In Func1=In Func0=In
0 komentar:
Posting Komentar