Page 1 of 1

PWM using Flowcode V5

Posted: Tue Jan 15, 2013 6:27 pm
by weatherman5
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

Re: PWM using Flowcode V5

Posted: Tue Jan 15, 2013 6:55 pm
by Enamul
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.

Re: PWM using Flowcode V5

Posted: Tue Jan 15, 2013 6:59 pm
by weatherman5
If you could that would be very kind.

Re: PWM using Flowcode V5

Posted: Tue Jan 15, 2013 9:33 pm
by Enamul
ok. No problem. I'll post to-night.

Re: PWM using Flowcode V5

Posted: Wed Jan 16, 2013 2:09 am
by Enamul
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.

Re: PWM using Flowcode V5

Posted: Wed Jan 16, 2013 10:34 am
by weatherman5
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

Re: PWM using Flowcode V5

Posted: Wed Jan 16, 2013 5:18 pm
by Enamul
Hi

Here is the screen shoots..

Re: PWM using Flowcode V5

Posted: Wed Jan 16, 2013 5:25 pm
by weatherman5
Hi Enamul

I very much appreciate your help with this, thank you Dave.

Re: PWM using Flowcode V5

Posted: Sun Jan 20, 2013 2:22 pm
by weatherman5
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

Re: PWM using Flowcode V5

Posted: Sun Jan 20, 2013 7:39 pm
by dazz
Hi Dave
have a look at this link http://www.matrixmultimedia.com/mmforums/search.php

you should find something in there
Regards
Dazz

Re: PWM using Flowcode V5

Posted: Sun Jan 20, 2013 10:03 pm
by kersing
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:

Code: Select all

5V ------------ LDR ----+------- Resistor ------------ GND
                        |
                   PIC analog in
Resistor value depends on LDR characteristics. Try different values or use a potentiometer.

Re: PWM using Flowcode V5

Posted: Sun Jan 20, 2013 11:08 pm
by weatherman5
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

Re: PWM using Flowcode V5

Posted: Sun Jan 20, 2013 11:12 pm
by dazz
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

Re: PWM using Flowcode V5

Posted: Mon Jan 21, 2013 9:51 am
by BChappy
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

Re: PWM using Flowcode V5

Posted: Thu Jan 24, 2013 8:14 pm
by weatherman5
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

Re: PWM using Flowcode V5

Posted: Thu Mar 14, 2013 8:00 am
by greentech
Hello,
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?

Re: PWM using Flowcode V5

Posted: Thu Mar 14, 2013 8:30 am
by medelec35
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?
No restriction on PWM with 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

Re: PWM using Flowcode V5

Posted: Fri Mar 15, 2013 7:29 am
by greentech
here is a screenshot. i cant c 2nd pwm in component macro and over panel.

Re: PWM using Flowcode V5

Posted: Fri Mar 15, 2013 7:55 am
by medelec35
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

PWM using Flowcode V5

Posted: Fri Mar 15, 2013 8:05 am
by greentech
Aah! Silly me. i was used to fc4 :)
Sorry guyz, got it now.

Re: PWM using Flowcode V5

Posted: Fri Mar 15, 2013 8:21 am
by medelec35
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 :)

PWM using Flowcode V5

Posted: Sun Mar 17, 2013 10:37 am
by greentech
Keep up the good work brainiacs.

Re: PWM using Flowcode V5

Posted: Tue Mar 19, 2013 12:41 pm
by greentech
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.

Re: PWM using Flowcode V5

Posted: Tue Mar 19, 2013 8:06 pm
by greentech
How can i invert the pwm for pushpull loads.

Re: PWM using Flowcode V5

Posted: Wed Mar 20, 2013 10:54 am
by Benj