The PIC reads the voltage coming out of the pot, which is in the range 0..5V, and redirects it to a built-in ADC with a 10-bit resolution. The ADC value, which is in the range 0..1023, is used to set up the duty cycle ratio of the PWM running at 244Hz (the minimum frequency achievable by running the PIC @4MHz). The PWM resolution in this case is 1024, hence matching the one of the ADC. The PWM output is available at pin RC5 drives LED through a current-limiting resistor. This way effective voltage on the LED is proportional to the pulse width of the PWM, which affects its brightness.PWM duty cycle ratio 3/4 (approx.)
Related Codes
There are no related downloads