Page 1 of 1

Simple bit bang method to vary LED brightness using POT

Posted: Thu Jul 02, 2009 10:26 pm
by medelec35
This was created with Flowcode V4 to vary LED brightness from really Dim to bright. Method uses a pot to control duty cycle of a bit bang PWM.
Target Chip = 16F887
Osc = int 4MHz
Approx PWM Freq= 193 Hz

As usual using Flowcode the target chip can be changed. However, if using a different chip, then config and osccon will require changing/removing to suit new target.
Please bear in mind this was created for a chip running at 4MHz. If run at a different frequency, then will not function as well.
This is my 1st bit bang attempt with a pot, although works really well,I'm sure it can be improved. (but only a little bit :P )