PWM using Flowcode V5
-
- Posts: 7
- Joined: Tue Jan 15, 2013 6:22 pm
PWM using Flowcode V5
Hi
I am running the free trial of Flowcode V5 and want to know if I can use it to bring an led from off to full brightness over say 0.5 second ?
I think this would be done using PWM which is built into the PIC I am using 16F628.
If I know it can be done I can purchase the full program.
Thanks, Dave
I am running the free trial of Flowcode V5 and want to know if I can use it to bring an led from off to full brightness over say 0.5 second ?
I think this would be done using PWM which is built into the PIC I am using 16F628.
If I know it can be done I can purchase the full program.
Thanks, Dave
- Enamul
- Posts: 1772
- Joined: Mon Mar 05, 2012 11:34 pm
- Location: Nottingham, UK
- Has thanked: 271 times
- Been thanked: 814 times
Re: PWM using Flowcode V5
Hi
It can be done in FCv5 very easily. If you want we can send you hex file so that you can test and decide to buy professional version.
It can be done in FCv5 very easily. If you want we can send you hex file so that you can test and decide to buy professional version.
-
- Posts: 7
- Joined: Tue Jan 15, 2013 6:22 pm
- Enamul
- Posts: 1772
- Joined: Mon Mar 05, 2012 11:34 pm
- Location: Nottingham, UK
- Has thanked: 271 times
- Been thanked: 814 times
- Enamul
- Posts: 1772
- Joined: Mon Mar 05, 2012 11:34 pm
- Location: Nottingham, UK
- Has thanked: 271 times
- Been thanked: 814 times
Re: PWM using Flowcode V5
Hi
Here is the code promised. The LED need to be connected to RB3<PIN9 of PIC16f628> through 470 ohm resistor and crystal has to be external for this code which is 4MHz should be connected to 15 & 16 pin. But if you want I can tell you how to use internal clock if you need.
Here is the code promised. The LED need to be connected to RB3<PIN9 of PIC16f628> through 470 ohm resistor and crystal has to be external for this code which is 4MHz should be connected to 15 & 16 pin. But if you want I can tell you how to use internal clock if you need.
- Attachments
-
- PWM_LED.hex
- (924 Bytes) Downloaded 493 times
-
- PWM_LED.fcf
- (8 KiB) Downloaded 900 times
-
- Posts: 7
- Joined: Tue Jan 15, 2013 6:22 pm
Re: PWM using Flowcode V5
Hi Enamul
It was very kind of you to send me the code, I will try it out.
The bit I wanted to see most was the Flowcode you also sent, but the free trial I am running is limited to just a few PIC devices, my PIC not being one of them. So it will not let me see your flow chart. Would it be possible to send me a screen shot image of the Flowcode flow chart ? That will tell me everything I need to know before purchasing the software.
Thanks, Dave
It was very kind of you to send me the code, I will try it out.
The bit I wanted to see most was the Flowcode you also sent, but the free trial I am running is limited to just a few PIC devices, my PIC not being one of them. So it will not let me see your flow chart. Would it be possible to send me a screen shot image of the Flowcode flow chart ? That will tell me everything I need to know before purchasing the software.
Thanks, Dave
- Enamul
- Posts: 1772
- Joined: Mon Mar 05, 2012 11:34 pm
- Location: Nottingham, UK
- Has thanked: 271 times
- Been thanked: 814 times
Re: PWM using Flowcode V5
Hi
Here is the screen shoots..
Here is the screen shoots..
- Attachments
-
- config_628.PNG
- (23.84 KiB) Downloaded 8267 times
-
- pwm.PNG
- (54.39 KiB) Downloaded 4444 times
-
- Posts: 7
- Joined: Tue Jan 15, 2013 6:22 pm
-
- Posts: 7
- Joined: Tue Jan 15, 2013 6:22 pm
Re: PWM using Flowcode V5
Hi Enamul
Thanks to your help I have purchased Flowcode 5 (Home) and have successfully designed my PIC and circuit so the led dims up, holds 100% then dims down, look great.
I was wondering if it was possible to add a light level detector to an input of the PIC, 16F628, so as to run the LED only when it was dark.
Dave
Thanks to your help I have purchased Flowcode 5 (Home) and have successfully designed my PIC and circuit so the led dims up, holds 100% then dims down, look great.
I was wondering if it was possible to add a light level detector to an input of the PIC, 16F628, so as to run the LED only when it was dark.
Dave
Re: PWM using Flowcode V5
Hi Dave
have a look at this link http://www.matrixmultimedia.com/mmforums/search.php
you should find something in there
Regards
Dazz
have a look at this link http://www.matrixmultimedia.com/mmforums/search.php
you should find something in there
Regards
Dazz
To sign up to the V5 forum follow this link http://www.matrixmultimedia.com/forum_upgrades.php
-
- Valued Contributor
- Posts: 2045
- Joined: Wed Aug 27, 2008 10:31 pm
- Location: Netherlands
- Has thanked: 553 times
- Been thanked: 1081 times
Re: PWM using Flowcode V5
There are several solutions for light level detection. One (simplest?) is to use a LDR connected to an analog input. Use the ADC component to read the input.
Wiring:
Resistor value depends on LDR characteristics. Try different values or use a potentiometer.
Wiring:
Code: Select all
5V ------------ LDR ----+------- Resistor ------------ GND
|
PIC analog in
“Integrity is doing the right thing, even when no one is watching.”
― C.S. Lewis
― C.S. Lewis
-
- Posts: 7
- Joined: Tue Jan 15, 2013 6:22 pm
Re: PWM using Flowcode V5
Hi kersing
I like your suggestion, very much what I had in mind.
So do you think I can connect this to PIC 16F628 ?
I guess if I can it would be to pin 17 or 18 AN0 / AN1.
Dave
I like your suggestion, very much what I had in mind.
So do you think I can connect this to PIC 16F628 ?
I guess if I can it would be to pin 17 or 18 AN0 / AN1.
Dave
Re: PWM using Flowcode V5
Hi Dave
if you follow the link and type ldr in the box there are a few good posts with examples, if your feeling adventurous theres also some post on using an led to sample light got a few crude ones up and running
Regards
Dazz
if you follow the link and type ldr in the box there are a few good posts with examples, if your feeling adventurous theres also some post on using an led to sample light got a few crude ones up and running
Regards
Dazz
To sign up to the V5 forum follow this link http://www.matrixmultimedia.com/forum_upgrades.php
- BChappy
- Posts: 15
- Joined: Fri Jun 19, 2009 11:03 pm
- Location: Lincoln, UK.
- Has thanked: 13 times
- Been thanked: 7 times
Re: PWM using Flowcode V5
Hi Guys,
Be aware that the 16F628a does not have an ADC, only comparator inputs!
I'm sure they'll be a snippet of code somewhere on here to do the light level detection with the comparator.
See post regarding 16F628a: http://www.matrixmultimedia.com/mmforum ... 46&t=10681
...and...
Welcome to the forum Dave!
Regards
Brian
Be aware that the 16F628a does not have an ADC, only comparator inputs!
I'm sure they'll be a snippet of code somewhere on here to do the light level detection with the comparator.
See post regarding 16F628a: http://www.matrixmultimedia.com/mmforum ... 46&t=10681
...and...
Welcome to the forum Dave!
Regards
Brian
Is your Project Not Working? - Help and General Advice Click here!
Flowcode v8 forum topic - Click here!
Flowcode v8 forum topic - Click here!
-
- Posts: 7
- Joined: Tue Jan 15, 2013 6:22 pm
Re: PWM using Flowcode V5
Hi Brian
Thanks for the welcome. I am enjoying programming up my first PIC.
I think light level detection with the comparator is just what I am after.
Dave
Thanks for the welcome. I am enjoying programming up my first PIC.
I think light level detection with the comparator is just what I am after.
Dave
-
- Matrix Staff
- Posts: 9521
- Joined: Sat May 05, 2007 2:27 pm
- Location: Northamptonshire, UK
- Has thanked: 2585 times
- Been thanked: 3815 times
Re: PWM using Flowcode V5
No restriction on PWM with Trial version.greentech wrote: I can only see one pwm for 16f877a. I know there are two pwms for this chip. This has to be a bug or restriction in trial version?
Do you mean you have set flowchart up correctly but can only see PWM on one of the hardware channels only
Or
You can only see one channel within your flowchart?
If the latter, then I have posted information on how to create more than 1PWM channel with Flowcode V5 here:
http://www.matrixmultimedia.com/mmforum ... 26&t=11694
Posting your Flowchart could help us to solve your issue more quickly.
Martin
Martin
-
- Matrix Staff
- Posts: 9521
- Joined: Sat May 05, 2007 2:27 pm
- Location: Northamptonshire, UK
- Has thanked: 2585 times
- Been thanked: 3815 times
Re: PWM using Flowcode V5
You need to add another PWM component, since you need to add an additional PWM component for each extra PWM channel your using.
E.g if your using 4 PWMs, you need to add 4 PWM components in total.
Martin
E.g if your using 4 PWMs, you need to add 4 PWM components in total.
Martin
Martin
-
- Matrix Staff
- Posts: 9521
- Joined: Sat May 05, 2007 2:27 pm
- Location: Northamptonshire, UK
- Has thanked: 2585 times
- Been thanked: 3815 times
Re: PWM using Flowcode V5
No worries greentech these things can catch you out if use to a different way.
Just remember to set both PWM components with the same settings:
http://www.matrixmultimedia.com/mmforum ... 570#p43570
I have altered the above post to mention about a requirement to add additional PWM pomonents, so you have helped other people out, by bringing it to my attention.
Thank you for that
Just remember to set both PWM components with the same settings:
http://www.matrixmultimedia.com/mmforum ... 570#p43570
I have altered the above post to mention about a requirement to add additional PWM pomonents, so you have helped other people out, by bringing it to my attention.
Thank you for that

Martin
- greentech
- Flowcode V4 User
- Posts: 158
- Joined: Mon Jan 31, 2011 2:11 pm
- Has thanked: 10 times
- Been thanked: 2 times
Re: PWM using Flowcode V5
i am trying to understand how to init 3 level pwm to obtain 50Hz sine output. I have to use pic16f877a. i also need to put some lcd functions voltage readings from mains and battery etc.
- 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: PWM using Flowcode V5
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel