Simple bit bang method to vary LED brightness using POT

Tips, Tricks and methods for programming, learn ways of making your programming life easier, and share your knowledge with others.

Moderators: Benj, Mods

Post Reply
User avatar
medelec35
Valued Contributor
Valued Contributor
Posts: 9135
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Contact:

Simple bit bang method to vary LED brightness using POT

Post 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 )
Attachments
3. CREATING BIT BANGED PWM CHANNELS V3.FCF
(7.5 KiB) Downloaded 647 times
Martin

Post Reply