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

help setting pwm4 to PIC16F1939

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



Joined: 04 Jun 2008
Posts: 23

View user's profile Send private message

help setting pwm4 to PIC16F1939
PostPosted: Wed Aug 24, 2011 10:32 am     Reply with quote

Hello
Can anyone help me with setting the pwm4 at pic16f1939. I done as at others micros but is doing only the envelope - during the pwm on it goes to high and if I disable the pwm output goes to low.
Code:

   #use delay(int=16000000)
   setup_timer_2(T2_DIV_BY_1,104,1);      //26.2 us overflow
   CCPTMRS0 = 0X00;  //set timer 2 for pwm4
   setup_ccp4(CCP_PWM);
   set_pwm4_duty(210);  //for 50%
   //setup_ccp4(CCP_OFF);

Thank you.
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Wed Aug 24, 2011 11:11 am     Reply with quote

Quote:
setup_timer_2(T2_DIV_BY_1,104,1); //26.2 us overflow
CCPTMRS0 = 0X00; //set timer 2 for pwm4
setup_ccp4(CCP_PWM);
set_pwm4_duty(210); //for 50%

During the pwm on it goes to high and if I disable the pwm output goes to low.


Read the links in the thread below about the difference between 8-bit and
10-bit PWM modes, and how to tell the compiler which mode to use:
http://www.ccsinfo.com/forum/viewtopic.php?t=45968
lboghy



Joined: 04 Jun 2008
Posts: 23

View user's profile Send private message

SOLVED
PostPosted: Wed Aug 24, 2011 3:40 pm     Reply with quote

I just added an "L"...
Thank you very much for you prompt support. 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