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
medelec35
Matrix Staff
Posts: 9520
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
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 809 times
Martin

Post Reply