Use of PWM

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
Walbeek
Flowcode v5 User
Posts: 68
Joined: Thu Mar 01, 2007 10:48 am
Location: Netherlands
Been thanked: 3 times
Contact:

Use of PWM

Post 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.
Greetings, Rinie
Flowcode V7 user

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: Use of PWM

Post 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

Walbeek
Flowcode v5 User
Posts: 68
Joined: Thu Mar 01, 2007 10:48 am
Location: Netherlands
Been thanked: 3 times
Contact:

Re: Use of PWM

Post 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
Greetings, Rinie
Flowcode V7 user

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: Use of PWM

Post 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
Martin

Walbeek
Flowcode v5 User
Posts: 68
Joined: Thu Mar 01, 2007 10:48 am
Location: Netherlands
Been thanked: 3 times
Contact:

Re: Use of PWM

Post 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
Attachments
Darthuizer test 004.fcf
(10 KiB) Downloaded 307 times
Greetings, Rinie
Flowcode V7 user

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: Use of PWM

Post 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
Martin

Walbeek
Flowcode v5 User
Posts: 68
Joined: Thu Mar 01, 2007 10:48 am
Location: Netherlands
Been thanked: 3 times
Contact:

Re: Use of PWM

Post by Walbeek »

Martin,

I have tested this in hardware and that works as it should.
Thanks very much for your help on this.

Rinie
Greetings, Rinie
Flowcode V7 user

Post Reply