mot1639
Member level 1
hi all
i write this code in Mikroc and it work fine with me .. in Proteus .. also i am using PIC16f877a @ 8Mhz
now the problem is how i can move the servo , 0,90,137,180,270,360 degree ?
now i have -90 and +90 ..
please help me out ..
regards
i write this code in Mikroc and it work fine with me .. in Proteus .. also i am using PIC16f877a @ 8Mhz
Code:
void PWM1_Init(const long freq);
void PWM1_Start(void);
void PWM1_Set_Duty(unsigned short duty_ratio);
void PWM1_Stop(void);
unsigned short i;
void main() {
PORTC = 00; // Set PORTC to $FF
TRISC = 0; // PORTC is output
Pwm1_Init(8000); // Initialize PWM module
Pwm1_Start(); // Start PWM
while (1) { // Endless loop
{
Pwm1_set_Duty(255);
delay_ms(1000);
Pwm1_set_Duty(127);
delay_ms(1000);
}
} }
now the problem is how i can move the servo , 0,90,137,180,270,360 degree ?
now i have -90 and +90 ..
please help me out ..
regards