18f4585 ile Enhanced PWM Modül uygulaması -CCS C

Başlatan fractal, 20 Ocak 2011, 12:37:23

fractal

#define ECCPR1H 0XFBC
#define ECCPR1L 0XFBB
#define ECCP1CON 0XFBA
#define ECCP1DEL 0XFB7
#define ECCP1AS 0XFB6
void main()
{

   setup_adc_ports(NO_ANALOGS);
   setup_adc(ADC_OFF);
   setup_psp(PSP_DISABLED);
   setup_spi(SPI_SS_DISABLED);
   setup_wdt(WDT_OFF);
   setup_timer_0(RTCC_INTERNAL);
   setup_timer_1(T1_DISABLED);
  *ECCP1CON=0X8C;

   setup_timer_3(T3_DISABLED|T3_DIV_BY_1);



     setup_timer_2(T2_DIV_BY_1,131,1);
    *ECCPR1L = 20; //Duty Cycle = Tosc * (CCPR1L<7:0>:CCP1CON<5:4>) * TMR2Prescaler -- for ease of use, ignore LSBs.
   *ECCP1DEL = 3; //Delay = 4 * Tosc * (ECCP1DEL<6:0>)
   *ECCP1AS = 0x00; //ECCP outputs are operating
   setup_comparator(NC_NC_NC_NC);
   setup_vref(FALSE);
//Setup_Oscillator parameter not selected from Intr Oscillotar Config tab
set_tris_c(0x00);
set_tris_d(0x00);
   // TODO: USER CODE!!
   while(1)
   {
   
   output_toggle(pin_b1);
   delay_ms(1000);
   
   
   }

}


[IMG]http://img51.imageshack.us/img51/394/halfbridgeeccp.jpg[/img]

Uploaded with ImageShack.us
Restantum cogniscutur Quantum deligutur

fractal

arkadaşlar bununla direkt puls trafosu sürülebilirmi?yoksa fet drivermı lazım araya?
Restantum cogniscutur Quantum deligutur

VFR

Enchanced PWM nedir? Normal PWM'den farkı nedir?