Page 1 of 1
PWM Outputs
Posted: Sun Sep 15, 2013 7:38 pm
by Michaelt
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
Re: PWM Outputs
Posted: Sun Sep 15, 2013 10:32 pm
by medelec35
Hi Michael,
If its not commercially sensitive, would you like to post your flowchart so we can take a look for you?
Martin
Re: PWM Outputs
Posted: Sun Sep 15, 2013 10:35 pm
by Kenrix2
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);
Re: PWM Outputs
Posted: Mon Sep 16, 2013 4:01 pm
by Michaelt
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).
Re: PWM Outputs
Posted: Mon Sep 16, 2013 8:18 pm
by Michaelt
Kenrix im not sure i fully understand the procedure u describe,, does that tell the pic only to use the desired pins??
Re: PWM Outputs
Posted: Mon Sep 16, 2013 9:35 pm
by Kenrix2
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.
Re: PWM Outputs
Posted: Tue Sep 17, 2013 5:19 pm
by Michaelt
Thanks a lot for your help it is working perfect now
thanks again for a fantastic service
Best Regards
Michael