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 support@ccsinfo.com

Can Timer1 be used to PWM on CCP1 / CCP2 ?

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



Joined: 07 Jan 2006
Posts: 64
Location: Braga

View user's profile Send private message Send e-mail MSN Messenger

Can Timer1 be used to PWM on CCP1 / CCP2 ?
PostPosted: Fri Nov 17, 2006 11:31 am     Reply with quote

I'm using this on a PIC16F877 :

void main() {

setup_timer_2(T2_DIV_BY_ 1, 130, 1); // 38KHz
setup_ccp1(CCP_PWM);
setup_ccp2(CCP_PWM);


set_pwm1_duty(DutyVariable1); // 1 to 99 duty cicle
set_pwm2_duty(DutyVariable2);

But as far as I know , TIMER2 only handle 8 bits. Can i use TIMER1 insted to use it 16Bit resolution ?
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Fri Nov 17, 2006 1:27 pm     Reply with quote

No, you can't use Timer1. Only Timer2 is used with the hardware
PWM modules in the 16F877. This is shown in the block diagram
in section 8.3 of the data sheet.

The best resolution you can get is 10 bits.
http://www.ccsinfo.com/forum/viewtopic.php?t=18259
http://www.piclist.com/techref/microchip/pwmrescalc.htm
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