CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

Alternate PWM Pin assignment for PIC12F1822

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
dave_s



Joined: 18 Aug 2011
Posts: 8

View user's profile Send private message

Alternate PWM Pin assignment for PIC12F1822
PostPosted: Mon Oct 10, 2011 8:21 am     Reply with quote

How do I assign PWM output to PIN_A5?
The code below still outputs PWM on PIN_A2 (default).
Code:

#byte APFCON = getenv("SFR:APFCON")
#bit CCP1SEL = APFCON.0

void main()
{
CCP1SEL = 1;
}
Ttelmah



Joined: 11 Mar 2010
Posts: 19537

View user's profile Send private message

PostPosted: Mon Oct 10, 2011 9:15 am     Reply with quote

If you are using the CCP setup after this, it'll override the setting. It has it's own setting to use this:
Code:

   setup_ccp1(CCP1_A5); //Put CCP1 output on A5


Best Wishes
dave_s



Joined: 18 Aug 2011
Posts: 8

View user's profile Send private message

PostPosted: Mon Oct 10, 2011 10:14 am     Reply with quote

Using the setting below does not output any PWM on either pin.
Does the timer need to be redirected?

setup_ccp1(CCP1_A5); //Put CCP1 output on A5
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Mon Oct 10, 2011 12:37 pm     Reply with quote

1. Post your compiler version.

2. Post a short but complete (compilable) pwm test program that shows
the failure.

This is an example of a short but compilable test program:
http://www.ccsinfo.com/forum/viewtopic.php?t=45185&start=1
You need to post something similar to that (especially that it's short).
Ttelmah



Joined: 11 Mar 2010
Posts: 19537

View user's profile Send private message

PostPosted: Mon Oct 10, 2011 2:58 pm     Reply with quote

As with several other chips, _you_ have to set the TRIS if you switch the PWM to the alternate pin. The default code sets it up for the default pin, but doesn't handle it when switched to the alternative.....

Best Wishes
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group