In this tutorial, we learn How to generate PWM signals using PIC PIC16F877A. Our PIC MCU has a special module called Compare Capture module (CCP) which can be used to generate PWM signals. Here, we will generate a PWM of 5 kHz with a variable duty cycle from 0% to 100%. To vary the duty cycle we are using a potentiometer, hence it is recommended to learn ADC tutorial before starting with PWM. PWM module also uses timers to set its frequency hence learn how to use timers beforehand here. Further, in this tutorial we will use a RC circuit and a LED to convert the PWM values to Analog voltage and use it for dimming the LED light.