Using Flowcode to run 3 PWM O/P's instead of usual 2
Posted: Mon Apr 26, 2010 2:37 pm
IMPORTANT NOTE: PLEASE LOOK AT POST DATED Fri Apr 30, 2010 10:29 pm FIRST.
THANK YOU.
Flowcode Attachment was created with flowcode 4.
This would be useful if you are already using both PWM components in Flowcode, and would like to set-up the third
If you are using 1 or more PWM channels with Flowcode then Both t2con and pr2 are not required.
Instructions: Just enter clock frequency , PWM frequency and Duty.
On flowchart Place a 0 output for each CCP in use. e.g if CCP3 is RB5, then use an output icon with B5 set at 0
Select prescaler to give highest Pr2.
Copy and paste cells containing required values into a flowcode C box after output icon e.g.
t2con = 0b0000101 ;
pr2 = 0b11111001 ;
ccpr1l = 0b01111101 ;
ccp1con = 0b00001100 ;
I have protected excel sheet to avoid entering data into wrong cells. There is no password if you would like to see how values are calculated.
za
Note example is using fosc=4MHz, fpwm=1KHz & Duty=50%
The code for pasting into C box will automatically change as you alter PWM frequencies, prescaler etc., removing all the hard work and saving time.
Also note that with older versions of excel (pre 2007 i believe), analysis toolpak will have to be added. I am new to running pwm with this method, so please let me know if I have made any mistakes. Thank you
THANK YOU.
Flowcode Attachment was created with flowcode 4.
This would be useful if you are already using both PWM components in Flowcode, and would like to set-up the third
If you are using 1 or more PWM channels with Flowcode then Both t2con and pr2 are not required.
Instructions: Just enter clock frequency , PWM frequency and Duty.
On flowchart Place a 0 output for each CCP in use. e.g if CCP3 is RB5, then use an output icon with B5 set at 0
Select prescaler to give highest Pr2.
Copy and paste cells containing required values into a flowcode C box after output icon e.g.
t2con = 0b0000101 ;
pr2 = 0b11111001 ;
ccpr1l = 0b01111101 ;
ccp1con = 0b00001100 ;
I have protected excel sheet to avoid entering data into wrong cells. There is no password if you would like to see how values are calculated.
za
Note example is using fosc=4MHz, fpwm=1KHz & Duty=50%
The code for pasting into C box will automatically change as you alter PWM frequencies, prescaler etc., removing all the hard work and saving time.
Also note that with older versions of excel (pre 2007 i believe), analysis toolpak will have to be added. I am new to running pwm with this method, so please let me know if I have made any mistakes. Thank you