Anyone have a PWM Dimmer program to dim just 1 LED?

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 4.
To post in this forum you must have a registered copy of Flowcode 4 or higher. To sign up for this forum topic please use the "Online Resources" link in the Flowcode Help Menu.

Moderator: Benj

Post Reply
Werner
Posts: 95
Joined: Sat Jun 11, 2011 4:12 am
Has thanked: 87 times
Been thanked: 31 times
Contact:

Anyone have a PWM Dimmer program to dim just 1 LED?

Post by Werner »

Hi Guys, I am looking for a simple one LED PWM dimmer program to help understand PWM. I found a few things in the forum and an article but thing where much more complicated that I am looking for.

Thanks a lot for the help!! :D

Werner
Werner
STUDENT OF: Martin - Professor of Flowcode, John, Jan, Fotios and Nicolas "Spanish Dude"

brandonb
Posts: 438
Joined: Mon Aug 29, 2011 12:26 am
Location: arizona
Has thanked: 175 times
Been thanked: 173 times
Contact:

Re: Anyone have a PWM Dimmer program to dim just 1 LED?

Post by brandonb »

with 3 tactiles controlling and lcd for feedback
Attachments
tactile pwm.fcf
(13.76 KiB) Downloaded 338 times
Last edited by brandonb on Wed Nov 30, 2011 3:45 am, edited 1 time in total.

brandonb
Posts: 438
Joined: Mon Aug 29, 2011 12:26 am
Location: arizona
Has thanked: 175 times
Been thanked: 173 times
Contact:

Re: Anyone have a PWM Dimmer program to dim just 1 LED?

Post by brandonb »

simple pwm macro only
Attachments
adc controlled pwm 0-85%.fcf
(5.5 KiB) Downloaded 342 times
Last edited by brandonb on Wed Nov 30, 2011 3:46 am, edited 2 times in total.

brandonb
Posts: 438
Joined: Mon Aug 29, 2011 12:26 am
Location: arizona
Has thanked: 175 times
Been thanked: 173 times
Contact:

Re: Anyone have a PWM Dimmer program to dim just 1 LED?

Post by brandonb »

this is an extention of the last file but with an lcd display... incase you were wondering the copyright thing is a joke for a friend of mine, i put it on all my stuff to make him and my self laugh
Attachments
PWM with lcd interface.fcf
(14.5 KiB) Downloaded 354 times

Werner
Posts: 95
Joined: Sat Jun 11, 2011 4:12 am
Has thanked: 87 times
Been thanked: 31 times
Contact:

Re: Anyone have a PWM Dimmer program to dim just 1 LED?

Post by Werner »

Hi Brandon, Thanks Buddy this is helpful! The last one with lcd does not have LED? Could upload the LED one.
Thanks for the help!

Werner
Last edited by Werner on Wed Nov 30, 2011 7:36 pm, edited 1 time in total.
Werner
STUDENT OF: Martin - Professor of Flowcode, John, Jan, Fotios and Nicolas "Spanish Dude"

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:

Re: Anyone have a PWM Dimmer program to dim just 1 LED?

Post by medelec35 »

Nice Flowchart Brandon!
Thanks for sharing it.
Werner if you placed an LED on the flowchart connected to the PWM output at Port C5 ,the LED will not light.
But it will work on your hardware.
That is because the PWM is hardware controlled using internal CCP1 and timer1 registers.
Don't forget to change the pin connections so LCD will work with Eblocks.

Re: Student of Martin. It's a great honour and you made my day that you have put that on your signature buddy.
However I'm sure there are other people with far more knowledge than me who deserves that title.
Thank you anyway.


Martin
Martin

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:

Re: Anyone have a PWM Dimmer program to dim just 1 LED?

Post by medelec35 »

Since PWM is hardware and not software driven and is automaticly assigned to CCP1, you don’t need to drag an LED or port component down onto flowchart.
By looking at 16F690 chip diagram in Flowcode, you can’t tell which pin is assigned to CCP1 as this and other data is missing. Therefore I have modified 16F690.fcd file.
Best to save a copy of original file first.
If you place the attached file in C:\Program Files (x86)\Matrix Multimedia\Flowcode V4\FCD
(64 bit windows)
Or
C:\Program Files\Matrix Multimedia\Flowcode V4\FCD
(32 bit windows)

Then look for CCP1 you can see its connected to RC5
16F690 connections.png
(19.39 KiB) Downloaded 4874 times
Martin
Attachments
16F690.fcd
(12.84 KiB) Downloaded 344 times
Martin

Werner
Posts: 95
Joined: Sat Jun 11, 2011 4:12 am
Has thanked: 87 times
Been thanked: 31 times
Contact:

Re: Anyone have a PWM Dimmer program to dim just 1 LED?

Post by Werner »

Hey Thanks Guys Ok now it is all making sense to me! For some reason I could not get it out of my head thinking that I needed and output for this but now I understand. The chip that I am actually working with is the 16F877A and I see it will be pins 16 and 17. Brandon the code for the tactile is really cool! I will play with this and see if I can get something working.

Yes Martin, there are many great contributors to the forum and Flowcode but for “me” you are the Professor of Flowcode. Not only is it the countless hours you give in helping all of us but also the gift you have of being able to convey thoughts and solutions that so great! It’s no wonder you have more thanks than even the Matrix staff! I know I speak for many; it’s just a very small way of reminding you how much I appreciate you! :D

Werner
Werner
STUDENT OF: Martin - Professor of Flowcode, John, Jan, Fotios and Nicolas "Spanish Dude"

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:

Re: Anyone have a PWM Dimmer program to dim just 1 LED?

Post by medelec35 »

Werner wrote: The chip that I am actually working with is the 16F877A and I see it will be pins 16 and 17.
Spot on! :)
17 is PWM ch1 and 16 is PWM ch2
Werner wrote:
Yes Martin, there are many great contributors to the forum and Flowcode but for “me” you are the Professor of Flowcode. Not only is it the countless hours you give in helping all of us but also the gift you have of being able to convey thoughts and solutions that so great! It’s no wonder you have more thanks than even the Matrix staff! I know I speak for many; it’s just a very small way of reminding you how much I appreciate you! :D

Werner
Thanks Werner.
For me it's Flowcode users like yourself that makes our replies so worth while.
You always appreciate the answers given, so helping you is a pleasure.

Regards

Martin
Martin

brandonb
Posts: 438
Joined: Mon Aug 29, 2011 12:26 am
Location: arizona
Has thanked: 175 times
Been thanked: 173 times
Contact:

Re: Anyone have a PWM Dimmer program to dim just 1 LED?

Post by brandonb »

Nice Flowchart Brandon!
Thanks for sharing it.
thanks martin, i've been absorbing all that you and fotios have been showing me :wink:
Brandon the code for the tactile is really cool!
werner, this one works good, the reason why i did it this way is because #1 tactiles are awsome, and the other reason is because using the count +1 deal for a pwm yeild great lcd display results, when i used the pot(adc) the display was always fighting between 2 adc bytes, alot of times the display was updating so fast that the % number was blank, so i added a delay, but the problem then was i found it annoying that the display was lagging when i turned the pot, so i came up with the tactile version to make it the way i desired, i use this for my automotive job to drive turbos, egr valves and such,.... are you in the states(usa)?

Werner
Posts: 95
Joined: Sat Jun 11, 2011 4:12 am
Has thanked: 87 times
Been thanked: 31 times
Contact:

Re: Anyone have a PWM Dimmer program to dim just 1 LED?

Post by Werner »

Brandon, that’s really cool! I like to see how you Guys code, some real clever stuff! The more I learning about Flowcode programing the more it seems that anything is possible. Yes Brandon I am just a little west of you in Socal. :D Thanks for the great examples.

Werner
Werner
STUDENT OF: Martin - Professor of Flowcode, John, Jan, Fotios and Nicolas "Spanish Dude"

brandonb
Posts: 438
Joined: Mon Aug 29, 2011 12:26 am
Location: arizona
Has thanked: 175 times
Been thanked: 173 times
Contact:

Re: Anyone have a PWM Dimmer program to dim just 1 LED?

Post by brandonb »

that’s really cool! I like to see how you Guys code, some real clever stuff
im a newbie at this too, been doing timerchips and logic gate stuff for the past 3 years, i got to the point of using entirely too many chips on a board, thats what got me in to flowcode, one pic chip is worth 100,000 logic chips?
I am just a little west of you in Socal.
hey neighbor :D

Post Reply