Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

2 PWM output has different freq

Status
Not open for further replies.

spartekus

Member level 5
Member level 5
Joined
May 27, 2010
Messages
81
Helped
1
Reputation
2
Reaction score
1
Trophy points
1,288
Location
Duisburg, Germany
Visit site
Activity points
1,918
Hi all,

I need to get 2 pwm output (not at the same time, my analog input choose which one will run). one of the pwm is around 1700 hz, another one is around 1900 hz.

any ideas why i read different frequencies at these pins, althought registers are same.
note: OC2RS also change with analog input but it is only for duty cycle as much as i know.

thanks a lot

Code:
   OC1CON  = 0b0000000000001110;
             OC1R    = 0;
             OC1RS   = 0;                              //hier müssen die daten eingeschrieben werden
             OC2CON  = 0b0000000000001110;
             OC2R    = 0;
             OC2RS   = 0;                              //hier müssen die Daten eingeschrieben werden
             T3CONbits.TCKPS0  = 1;
             T3CONbits.TCKPS   = 0;
             T3CONbits.TSIDL  = 1;
             T3CONbits.TON  = 1;
             IEC0bits.T3IE  = 0;
               PR3   = 4095;                           // PERIODENREGISTER LEGT DIE PWM FREQUENZ FEST
 

Hi,

What controller do you use?
Is this the complete pwm setup?
What's the microcontroller's clock source and clock frequency?

Klaus
 

Hi Klaus,

I use Pic24FJ64GA002.
yes it is all about pwm, but duty cycle of pwm change during the code, with analog input.

in case i may tell wrong, i will paste the code about freq. it is other worker's code who is not anymore.

Code:
_CONFIG1( JTAGEN_OFF & FWDTEN_ON & FWPSA_PR128 & WDTPS_PS512 )   //konfiguriert für 16MHZ
          _CONFIG2( FNOSC_FRCPLL  &  FCKSM_CSDCMD  & OSCIOFNC_ON )

Code:
      void oszillator_init()
     {
             _DOZEN = 1;
              _DOZE = 1;
            _RCDIV0 = 0;
            _RCDIV1 = 0;
            _RCDIV2 = 0;
  
     }

thanks for your answer.

correction : one of pwm is around 2.5 khz other is 1.9 khz
 
Last edited:

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top