Header Ads

Variable resistor control LED Dimmer use PIC Microcontroller and Mikro C

In this tutorial we will learn how to LED brightness control use variable resistor. Here I am use PIC16F877A Microcontroller. 
You can watch the video or read the written tutorial below.




PIC16F877A Microcontroller has two CCP module. CCP means Capture Compare Pulse Width Modulation. It generate different duty cycle pulse. The Analog output voltage of microcontroller depend on duty cycle. When duty cycle 0% than output voltage of CCP is 0 volt , duty cycle 50% output voltage 2.5 volt and duty cycle 100% out is 5 volt.

Circuit Diagram



In this project I am use Analog Channel 0  for analog voltage input. The output of CCP module depend on input analog voltage. When increase the input analog voltage the output of Duty Cycle increase. The Duty Cycle is proportional of input Analog voltage.



Mikro C Code:





Click the download button for program file download.

download

1 comment:

  1. What does the 4.89 indicate or where does it come from?

    ReplyDelete

Theme images by 5ugarless. Powered by Blogger.