farklı pwm frekansı

Başlatan elbinaz, 16 Ağustos 2012, 10:55:46

elbinaz

#include <16F877A.h>
#device ADC=10
#use delay(clock=20000000)
#fuses NOWDT, NOPROTECT, NODEBUG, NOBROWNOUT, HS
#use fast_io(C)
#use fast_io(A)
#include <stdlib.h>
#define use_portb_lcd TRUE  //B YE BAĞLI LCD
#include <lcd.c>
//float feedback,error,pre_error,integral,derivative; 
//float control,setpoint,Kp,Ki,Kd,P,I,D,dt;
//int count;
void main()
{
  setup_psp(PSP_DISABLED);                 // Configre for PWM mode
  setup_timer_1(T1_DISABLED);                 // Configre for PWM mode
  setup_adc_ports(NO_ANALOGS);               //analog giriş yok
  setup_CCP1(CCP_PWM);                 // Configre for PWM mode
  setup_timer_2(T2_DIV_BY_4,24,1);   // prescale=16, PR2=255, postscale=1
  set_pwm1_duty(16);                  // - 50 khz yaptım
 
 
  set_tris_a(0b00011111);              // RA0 -> RA4 as input
  set_tris_c(0x00);                    // Port C as output
 
  LCD_init();                          // Configure for LCD
  //LCD_putcmd(0x84);
  printf(LCD_putc,"Test ");      // Display project's name
  //LCD_putcmd(0xc1);
  //printf(LCD_putchar,"Status: NOT OK");//
  delay_ms(5);
  while(1)
  {
   //set_adc_channel(0);
   //feedback = read_adc();
   //printf(lcd_putc,"\f error=%ld",error);
   //delay_ms(5);
   //printf(lcd_putc,"\f control=%ld",control);
   //delay_ms(5);
}
}

burada 50 khz hesapladım ama 5 hz frekans veriyor sebep ne olabilir? CEVAP YOK MU?TEMASSIZLIK VARMIŞ HALLOLDU