Chat freely about anything...

User avatar
By alexmercer
#89273 SETUP FOR PWM OPERATION
The following steps should be taken when configuring
the CCP module for PWM operation:
1. Select TMR2 or TMR4 by setting or clearing the
T3CCP2:T3CCP1 bits in the T3CON register.
2. Set the PWM period by writing to the PR2 or
PR4 register
3. Set the PWM duty cycle by writing to the
CCPR4L register and CCP4CON<5:4> bits.
4. Make the CCP4 pin an output by clearing the
TRISG<3> bit.
5. Set TMR2 or TMR4 prescale value, enable
Timer2 or Timer4 by writing to T2CON or
T4CON.
6. Configure the CCP4 module for PWM operation.
User avatar
By eriksl
#89345 These registers do not exist on the ESP8266. I think you're referring to the ESP32, which has all kinds of fancy hardware supported PWM functionality. The ESP8266 DOES NOT have hardware for PWM generation.