Hi, All
Please if any one Can help me in the follwoign code :
#class auto
#use RCM41xx.LIB
#define ADC_SCLKBAUD 115200ul
nodebug
void sDelay(unsigned int delay)
{
auto unsigned long done_time;
done_time = SEC_TIMER + delay;
while( (long) (SEC_TIMER - done_time) < 0 );
}
void main()
{
unsigned long freq;
auto float Draw;
brdInit();
freq = pwm_init(20);// [I][B]It returen 112 Hz[/B][/I]
sDelay(1);
while(1)
{
Draw = anaIn(0, SINGLE, GAIN_2);
Draw = Draw/5.24 + 100;
pwm_set(0, (int)(Draw), PWM_USEPORTE);
}
}
I used this code to controlle Servo Motor Using a Varible Resistor.
But The Out put Frequency of the PWM is 112 Hz, and the typical frequency should be about 50 Hz.
I tried to reduce the Frequency in // freq = pwm_init(20);// But the Min Value I get is 112 Hz.
So Please if any one can Help Me in that .
Regards
Redwan