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

2 PWM in 16F876???

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



Joined: 17 Aug 2004
Posts: 12

View user's profile Send private message

2 PWM in 16F876???
PostPosted: Tue Aug 17, 2004 12:16 am     Reply with quote

In the manual and in the datasheet, specifies that 16f876 has 2 PWM (C1 and C2).
I put this in the CCS:

Code:
   setup_timer_2(T2_DIV_BY_1,9,1);              //4Mhz, 100 Khz PWM timer
   output_high(PIN_C1);                         //Init Pin C1 as output
   output_high(PIN_C2);                         //Init Pin C2 as output
   setup_ccp1(CCP_PWM);                         //Mode PWM CPP1
   setup_ccp2(CCP_PWM);                         //Mode PWM CPP2
   set_pwm1_duty(10);                           //Init PWM1 (10=100%..0=0%)
   set_pwm2_duty(10);                           //Init PWM2 (10=100%..0=0%)


Ok, this doesnīt work. Only works the PWM2 (C1) , the PWM1 (C2) is always 0.
Why? Whatīs is wrong? I canīt configurate the two PWM at same time?
Thank you very much
Kenny



Joined: 07 Sep 2003
Posts: 173
Location: Australia

View user's profile Send private message

PostPosted: Tue Aug 17, 2004 1:31 am     Reply with quote

It works for me (compiler version 3.188). Your arithmetic is fine.
I didn't change anything in your code. Also I tested it by sweeping the values from 0 to 10 and back to 0, all OK.
verba



Joined: 17 Aug 2004
Posts: 12

View user's profile Send private message

Not for me
PostPosted: Tue Aug 17, 2004 3:34 am     Reply with quote

I have 3.155
Is it possible that my version doesnīt compile correctly the PWM ?
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