Page 1 of 1

50Hz PWM

Posted: Sun Nov 17, 2013 9:56 pm
by saad.sharif
please any one can tell me how to make 50 Hz with pwm in flowcode.... i am using 4MHZ crystal please kindly tell... i shall be very thankful to you.....

Re: 50Hz PWM

Posted: Mon Nov 18, 2013 5:24 pm
by Benj
Hello,

I moved the post as it seems to be relating to a new topic.

Which version of Flowcode are you using? I think the Hardware PWM will not run this slow but it should be possible using a timer based software driven PWM.

Re: 50Hz PWM

Posted: Mon Nov 18, 2013 6:32 pm
by saad.sharif
HELLO

i am using flowcode version 5.1...

Re: 50Hz PWM

Posted: Mon Nov 18, 2013 9:27 pm
by brandonb
you'll have to set if up for your chip, and change c code to

Code: Select all

t2con=4; pr2=199;
YOUR PWM.fcf
(13.23 KiB) Downloaded 715 times

Re: 50Hz PWM

Posted: Mon Nov 18, 2013 10:05 pm
by saad.sharif
HELLO

sir i am having 4 MHZ crystal and 16f887 pic micro controller... plz can u draw it with my requirements please...
i shall b thank full to you..

Re: 50Hz PWM

Posted: Mon Nov 18, 2013 10:52 pm
by saad.sharif
hello brandonb


it is not working ....

Re: 50Hz PWM

Posted: Tue Nov 19, 2013 3:05 am
by brandonb
here you are, this is a 50hz pwm 0-100% sweep program set up for your chip
YOUR PWM.fcf
(9.5 KiB) Downloaded 727 times
cheers

Re: 50Hz PWM

Posted: Tue Nov 19, 2013 9:37 am
by saad.sharif
hello

sir if i want to add adc with 0-100% sweep .... please can you do it for me....
and thanks for the 50 hz...
saad shaarif

Re: 50Hz PWM

Posted: Tue Nov 19, 2013 4:16 pm
by saad.sharif
hello mr brandonb,

sorry for disturbing you again again... sir i want to to out puts.. which work one by one for example if port A5 is 1 then port A2 is 0 and when port A5 is 0 then port A2 is 1... in this way i want 50 hz... and duty cycle must same on both ports...

please can u draw it for me....

and i have added adc to your pwm that you uploaded it i just want to see how you add adc with it...

saad sharif..
have a nice day sir..!

Re: 50Hz PWM

Posted: Tue Nov 19, 2013 8:14 pm
by brandonb
when i get off work will get that done for you

Re: 50Hz PWM

Posted: Wed Nov 20, 2013 9:01 pm
by saad.sharif
Hello brandonb,

please kindly help me i am waiting...... is there any problem for you to do....


saad sharif

have a nice day..!

Re: 50Hz PWM

Posted: Wed Nov 20, 2013 10:00 pm
by medelec35
Hi saad ,
All you will need to do is use an ADC component (ReadAsByte)
use a formula to convert from 0 - 255 to 0 - 100
assigned the result to a variable called pwm.
Finally delete

Code: Select all

pwm = pwm + 1
calculation box.
Then you will have a pwm duty thats will be controlled by ADC pot.

Can you please give it a go, then if your stuck, you can post flowchart for further assistance.

Martin

Re: 50Hz PWM

Posted: Thu Nov 21, 2013 7:47 pm
by saad.sharif
HI MARTIN

i have done it as you told.. but i want two outputs of 50 hz pwm with the same duty cycle on both ports..
can you help me for that.


saad sharif
have a nice day.!

Re: 50Hz PWM

Posted: Thu Nov 21, 2013 7:58 pm
by medelec35
If you post a flowchart, with your modifications, what you want can be easily modified for you.

Martin

Re: 50Hz PWM

Posted: Thu Nov 21, 2013 8:18 pm
by saad.sharif
Here is it...

Re: 50Hz PWM

Posted: Mon Nov 25, 2013 10:57 pm
by medelec35
Hi saad.sharif,
You can try this Flowchart

Martin