0
\$\begingroup\$

I am trying to design a control for a BLDC motor with a PIC16F887.

I have managed to activate a PWM output and be able to vary it with a potentiometer. The point is, I need to get 6 PWM signals out.

When I change the CCP1CON I can vary the PWM output but it is always one.

I attach the part of my code where I configure the PWM.

void PWM_Initialize()
{
  PR2 = ("%#x", (_XTAL_FREQ/(PWM_freq*4*TMR2PRESCALE)) - 1);
  CCPR1L = 0x1F; 
  RC1 = 0; 
  RC2 = 0;    
  T2CON = 0x03;    
  CCP1CONbits.CCP1M = 0b1100;
  CCP1CONbits.P1M = 0b00;
  TMR2 = 0;
  T2CONbits.TMR2ON = 1; //Timer 2 ON     
}

How can I activate multiple PWM outputs?

\$\endgroup\$
3
  • 2
    \$\begingroup\$ You've chosen the wrong micro for this job. Your PIC16F877 only has 1 PWM module. \$\endgroup\$
    – brhans
    May 25, 2020 at 21:03
  • \$\begingroup\$ @brhans Thanks for your answer. I have seen examples with this PIC16F887 where they generate 6 PWM signals. How do they do that? With the TIMER? It is a great question that I have. \$\endgroup\$
    – Geo
    May 26, 2020 at 6:02
  • \$\begingroup\$ Please cite the examples so we can discuss - otherwise we can only speculate. \$\endgroup\$ May 26, 2020 at 13:42

1 Answer 1

2
\$\begingroup\$

Your Controller has got only 2 PWM outputs. The PIC16F1783 could maybe help you.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.