PWM Using PIC30F6010A

Discussion in 'The Projects Forum' started by rmrps, Nov 5, 2012.

  1. rmrps

    Thread Starter New Member

    Feb 24, 2012
    17
    0
    Hi friends i am using Pic30F6010A microcontroller for pulse width modulation genaration for invertor application anyone please give me guidelines to generate pwm using pic30f6010a and where to take the output that is microcontroller Pwmpin high with respect to ground or Pwmpin high with respect to pwm pin low please give me a sample code and output taken procedure thanks in advance
     
  2. THE_RB

    AAC Fanatic!

    Feb 11, 2008
    5,435
    1,305
    I don't want to sound unfriendly but you REALLY need to read through the PIC datasheet, it will have chapters dedicated to the capture compare and PWM modules, showing how to setup the PWM you need.
     
  3. rmrps

    Thread Starter New Member

    Feb 24, 2012
    17
    0
    _FOSC(CSW_FSCM_OFF & XT_PLL8);
    _FWDT(WDT_OFF);
    _FBORPOR(PBOR_ON & MCLR_EN & PWRT_OFF);
    _FGS(CODE_PROT_ON);

    void Delay(unsigned int del);

    int main(void)
    {

    Delay(50000);
    Delay(50000);
    Delay(50000);
    Delay(50000);
    Delay(50000);
    TRISE=0x00;
    PORTE=0x00;
    PTCON=0x8004;
    PTMR=100;
    PTPER=199;
    IPC9bits.PWMIP=1;
    IFS2bits.PWMIF=0;
    IEC2bits.PWMIE=1;
    SEVTCMP=0x00;
    PWMCON1=0xFFF;
    PWMCON2=0x207;
    DTCON1=0x4C4C;
    DTCON2=0xFF;

    FLTACON=0xFF80;
    FLTBCON=0xFF80;
    OVDCON=0xFF00;
    PDC1=0x0A;
    PDC2=6553.6;


    while(1)
    {
    Delay(50000);
    Delay(50000);
    Delay(50000);
    }
    return (0);
    }

    void Delay(unsigned int del)
    {
    while(--del);
    }


    this is my code pwm pulses generated but the frequency was not changed by changing PTPER value please give me a guidelines to change frequency. i am using 16Mhz frequency for controller
     
    Last edited: Nov 6, 2012
Loading...