The motor worked. it turns from 0 to 90 to 180 and any other angle in between. it has a precision of 1 degree. one and half months work .. phew!
the only problem now is that we got it working using the " delay_us" function in mikro C .. but the thing is our "time delay" value is a variable which will vary with respect to the angle required for the motor turn.
when we tried using "vdelay_ms()" and give a value such as "0.6" or 1.2 in the brackets the program doesnt work how it is expected to. can someone help me to write a program wher i can give the variable delay in us instead of ms. something like "vdelay_us" which doesnt exist in mikro C. Alain , you said your familiar with mKC rite? any help?
Nigel, the waves in the DSO where perfect. they had a magnitude of 4V across a 220 ohm resistor.
the mikro c prog i used was :
void main()
{
float x ; // used when the vdelay_ms function was used
int count,time;
PORTC=0 ;
TRISC=0 ;
count=0;
while (1)
{
while(count<50) // moves the motor to 90 degrees
{
PORTC.F3=1;
delay_us(1499);
PORTC.F3=0;
delay_us(20000-1499);
count++;
}
// WHEN 1499 us was given in delay_us function as in above it worked
//to move the motor to 90 degrees but when used in vdelay_ms function
// went to only 49.8 degrees. when x is changed there is no continous change
// in degrees but in irregular intervals
//while(count<50)
//{
//x=1.499;
//PORTC.F3=1;
//vdelay_ms(x);
//PORTC.F3=0;
//vdelay_ms(20-x);
//count++;
//}
count=0;
while(count<50)
{
PORTC.F3=1;
delay_us(2395); // moves the motor to 180 degrees
PORTC.F3=0;
delay_us(20000-2395);
count++;
}
count=0;
}
}