-->
Page 14 of 14

Re: how can i use pwm?

PostPosted: Sat Oct 31, 2020 7:34 am
by alexmercer
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.

Re: how can i use pwm?

PostPosted: Sun Nov 08, 2020 11:49 am
by eriksl
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.