Page 1 of 1
Use of PWM
Posted: Tue Jun 04, 2013 10:58 am
by Walbeek
Hi there,
I´m trying to use PWM in Flowcode 5 (I can´t post in the FC5 forum)
I use a counter to set PWM duty cycle on CCP1.
How can I connect the PWM signal to a led to adjust brightness?
If a connect a led, nothing is shown.
Please give me some hints on this.
Re: Use of PWM
Posted: Tue Jun 04, 2013 11:05 am
by Benj
Hello,
Access to the v5 topic can be obtained by following the link in my signature.
This article on controlling LEDs may help.
http://www.matrixmultimedia.com/article.php?a=52
Re: Use of PWM
Posted: Tue Jun 04, 2013 11:30 am
by Walbeek
Hello Ben,
Thanks for your reply.
I have used the PWM function and the duty-cycle is changing, according the counter value.
When I connect a led to the output RC1 or RC5 of the PIC16F1824, nothing shows.
I don´t know how to get the value of the PWM to an output pin.
Rinie
Re: Use of PWM
Posted: Tue Jun 04, 2013 12:39 pm
by medelec35
Have you checked your configuration settings are all set correctly?
That is the main cause of hardware not working.
If you click on my signature, that should help.
If following that does not work and If not commercially sensitive, can you please post your flowchart, then someone i'm sure will help you further.
Martin
Re: Use of PWM
Posted: Tue Jun 04, 2013 12:47 pm
by Walbeek
Hello Medelec,
Thanks for your reply.
For now, i only have tested the software simulation on PWM.
I want to connect a led to an output pin and adjust the brightness while flashing.
So the led has to go from 0% to 100% and back to 0% in approx. 1 second.
For this i want to use the PWM signal and set the duty cycle of this with a counter value.
So first, i´m trying to get in to blink.
I have attached the test file for this.
As you can see, with a led on every pin.
So I asume that the led has to blink as discribed before.
Rinie
Re: Use of PWM
Posted: Tue Jun 04, 2013 1:50 pm
by medelec35
Hi Rinie,
Since PWM signal is generated by internal registers, you will not be able to connect an LED to PWM output to observe PWM duty (Simulation only). This is normal, and does not mean PWM is not being generated.
It should work on your hardware ok.
Martin
Re: Use of PWM
Posted: Tue Jun 04, 2013 2:41 pm
by Walbeek
Martin,
I have tested this in hardware and that works as it should.
Thanks very much for your help on this.
Rinie