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

pwm + pic18f14k50

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



Joined: 20 Nov 2010
Posts: 44

View user's profile Send private message

pwm + pic18f14k50
PostPosted: Tue Sep 17, 2013 11:04 pm     Reply with quote

hi.

Help. How to configure PWM output RC3?

Code:
   setup_timer_2(T2_DIV_BY_4,249,1);
   setup_ccp1(CCP_PWM);
   set_pwm1_duty(500);
Ttelmah



Joined: 11 Mar 2010
Posts: 19552

View user's profile Send private message

PostPosted: Wed Sep 18, 2013 4:16 am     Reply with quote

You have to use 'pulse steering'.

Code:

   setup_timer_2(T2_DIV_BY_4,249,1);
   setup_ccp1(CCP_PWM | CCP_PULSE_STEERING_C);
   //RC3, is P1C, hence the 'C' here.
   set_pwm1_duty(500);


A few older compilers, don't correctly set the TRIS when this is done, but current ones do. If your's doesn't, add 'output_drive(PIN_C3);'.

Best Wishes
fkl



Joined: 20 Nov 2010
Posts: 44

View user's profile Send private message

PostPosted: Wed Sep 18, 2013 7:37 am     Reply with quote

thank you very much.
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