adalah
Newbie level 6
Servo Problems
Hi everyone..
i still need your help about my code in mikroC.
my problems is when i run the simulation using the ISIS ( Proteus),
1st servo automatically run.
in this code,
i declare the start button,
where i should activate the start button first,
and then the servo will start operate.
here i upload my hex code and the circuit.
hope anyone can solve my prob.
Hi everyone..
i still need your help about my code in mikroC.
#define start porta.f4
#define right porta.f0
#define left porta.f1
void foward();
void main()
{
TRISA=0XFF;
TRISB=0;
TRISC=0;
PORTC=0;
TRISD=0;
PORTD=0;
ADCON1 = 10000000;
if (start==1)
{
foward();
}
}
void foward(void)
{
do{
portd.f0=1;
delay_ms(100);
portd.f0=0;
delay_ms(100);
portc.f0=1;
delay_ms(2);
portc.f0=0;
delay_ms(2000);
portc=0;
portc.f2=1;
delay_ms(1);
portc.f2=0;
delay_ms(2000);
portc=0;
portc.f0=1;
delay_ms(1);
portc.f0=0;
delay_ms(2000);
portc=0;
portc.f4=1;
delay_ms(2);
portc.f4=0;
delay_ms(2000);
portc=0;
portc.f0=1;
delay_us(1500);
portc.f0=0;
delay_ms(2000);
portc=0;
portc.f2=1;
delay_ms(2);
portc.f2=0;
portc.f4=1;
delay_ms(1);
portc.f4=0;
delay_ms(2000);
portc=0;
}while(1);
}
my problems is when i run the simulation using the ISIS ( Proteus),
1st servo automatically run.
in this code,
i declare the start button,
where i should activate the start button first,
and then the servo will start operate.
here i upload my hex code and the circuit.
hope anyone can solve my prob.