Haberler:

Eposta uyarılarını yanıtlamayınız ( ! ) https://bit.ly/2J7yi0d

Ana Menü

RC servo bozulurmu?

Başlatan gambit1244, 13 Kasım 2011, 20:06:54

gambit1244

merhaba ustalarım bir rc servo için kod yazdım aşağıdaki kod isiste düzgün olarak çalışıyor fakat kite attıgımda servo en sona kadar gitip cazur cuzur otüyor sadece
geri gelmesi gerekirken geri gelmiyor neden boyle yapar servo motoru bozmuş olabilirmiyim
(servo motor hareket ediyor fakat saçmalıyor)
#include <18F4580.h>
#device ICD=TRUE

#FUSES NOWDT                    //No Watch Dog Timer
#FUSES WDT128                   //Watch Dog Timer uses 1:128 Postscale
#FUSES HS                       //High speed Osc (> 4mhz for PCM/PCH) (>10mhz for PCD)
#FUSES FCMEN                    //Fail-safe clock monitor enabled
#FUSES IESO                     //Internal External Switch Over mode enabled
#FUSES NOPUT                    //No Power Up Timer
#FUSES NOBROWNOUT               //No brownout reset
#FUSES BORV21                   //Brownout reset at 2.1V
#FUSES PBADEN                   //PORTB pins are configured as analog input channels on RESET
#FUSES LPT1OSC                  //Timer1 configured for low-power operation
#FUSES MCLR                     //Master Clear pin enabled
#FUSES STVREN                   //Stack full/underflow will cause reset
#FUSES NOLVP                    //No low voltage prgming, B3(PIC16) or B5(PIC18) used for I/O
#FUSES BBSIZ2K                  //2K words Boot Block size
#FUSES NOXINST                  //Extended set extension and Indexed Addressing mode disabled (Legacy mode)
#FUSES NODEBUG                  //No Debug mode for ICD
#FUSES NOPROTECT                //Code not protected from reading
#FUSES NOCPB                    //No Boot Block code protection
#FUSES NOCPD                    //No EE protection
#FUSES NOWRT                    //Program memory not write protected
#FUSES NOWRTC                   //configuration not registers write protected
#FUSES NOWRTB                   //Boot block not write protected
#FUSES NOWRTD                   //Data EEPROM not write protected
#FUSES NOEBTR                   //Memory not protected from table reads
#FUSES NOEBTRB                  //Boot block not protected from table reads

#use delay(clock=20000000)


void main()
{

setup_timer_1(T1_INTERNAL|T1_DIV_BY_1);      //13.1 ms overflow
setup_timer_2(T2_DIV_BY_16,255,1);      //819 us overflow, 819 us interrupt
   setup_timer_3(T3_DISABLED|T3_DIV_BY_1);
   setup_ccp1(CCP_PWM);
   setup_ccp2(CCP_PWM_FULL_BRIDGE|CCP_SHUTDOWN_AC_L|CCP_SHUTDOWN_BD_L);
   set_pwm1_duty(1);
   set_pwm2_duty(1);
   setup_comparator(NC_NC_NC_NC);


    while(true){      output_low(LED);
   set_pwm1_duty(51);
   set_pwm2_duty(51);
     
      delay_ms(DELAY);
       set_pwm1_duty(202);
   set_pwm2_duty(202);
      output_high(LED);
      delay_ms(DELAY);
}
}
[email]tufan_ozbek@hotmail.com[/email] Yesterday is history. Tomorrow is a mystery. Today is a gift aslında bütün mesele bu.