Hello Matrix
I am programming a Pic 16f1936 and using all pins on the chip. I would like to setup 2 Pwm channels Pin 24 RB3/CCP2 and pin 26 RB5/CCP3.
My problem is that if i setup the macro to pin2 = CCP2 both RC1/CCP2 and and RB3/CCP2 is pwm'ed, is it possible to only use one of each of the ccp2 and ccp3 pins??
Hope this is understandable
Best Regards
From Michael
PWM Outputs
Moderator: Benj
-
- 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 Outputs
Hi Michael,
If its not commercially sensitive, would you like to post your flowchart so we can take a look for you?
Martin
If its not commercially sensitive, would you like to post your flowchart so we can take a look for you?
Martin
Martin
-
- Flowcode v5 User
- Posts: 211
- Joined: Tue Feb 19, 2013 9:51 pm
- Has thanked: 72 times
- Been thanked: 177 times
Re: PWM Outputs
Your trying to use alternate pins for CCP2 and CCP3. Flowcode will set the correct pins as outputs when you check the box "Use alternative pin" but it does not set the bits in the APFCON:ALTERNATE PIN FUNCTION CONTROL REGISTER so you have to do it manually. Drop a "c code icon" into your program before enabling the PWM and put this in it:
set_bit(apfcon,CCP3SEL);
set_bit(apfcon,CCP2SEL);
set_bit(apfcon,CCP3SEL);
set_bit(apfcon,CCP2SEL);
Re: PWM Outputs
here is a copy of the flowchart witch is far from finished, The pwm is in the temperature_output_control macro.
i just wanted to test the pwm outputs witch control 2 12v fans. but instead of driving the fan the lcd display starts going cracy because CCP3 is both outputted to pin 17 and 26 and i am only interested in port 26(RB5). and for ccp2 i want pin 24(RB3).
i just wanted to test the pwm outputs witch control 2 12v fans. but instead of driving the fan the lcd display starts going cracy because CCP3 is both outputted to pin 17 and 26 and i am only interested in port 26(RB5). and for ccp2 i want pin 24(RB3).
- Attachments
-
- Beer_Dispenser_V1.0.fcf
- (50.25 KiB) Downloaded 338 times
Re: PWM Outputs
Kenrix im not sure i fully understand the procedure u describe,, does that tell the pic only to use the desired pins??
-
- Flowcode v5 User
- Posts: 211
- Joined: Tue Feb 19, 2013 9:51 pm
- Has thanked: 72 times
- Been thanked: 177 times
Re: PWM Outputs
Attached is a program to show how to do it so you can test it in hardware. In your program PWM FanIntake and PWM FanExhaust are using the same channels.
- Attachments
-
- 16F1936_PWM_alt_pin_test.fcf
- (9 KiB) Downloaded 360 times
Re: PWM Outputs
Thanks a lot for your help it is working perfect now 
thanks again for a fantastic service
Best Regards
Michael

thanks again for a fantastic service
Best Regards
Michael