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

PIC16F88 and PWM

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



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Tue Jun 24, 2008 12:09 pm     Reply with quote

I stripped your program down somewhat by getting rid of all the printf
statements, and then I compiled it with vs. 4.074 and ran it on a
PicDem2-Plus board. It works. I see PWM output on pin B0.
Code:

#include <16F88.h>
#fuses HS,NOWDT,NOPROTECT,NOLVP
#use delay(clock=20000000)

//==========================================
void main()
 {
byte value;

value = 0;

setup_ccp1(CCP_PWM);
setup_timer_2(T2_DIV_BY_4, 255, 1);
set_pwm1_duty(0); // PWM off

delay_ms(1000);

while(1)
  {
   value++;
   set_pwm1_duty(value);
   delay_ms(100);
  }

}


--------
Edit: Initialized 'value' to 0.


Last edited by PCM programmer on Wed Aug 26, 2009 7:13 pm; edited 1 time in total
xavier



Joined: 10 Feb 2004
Posts: 7

View user's profile Send private message

PIC16F88 and PWM
PostPosted: Wed Jun 25, 2008 1:38 am     Reply with quote

Many thanks PCM programmer for your help I found my pb ! (you mention RB0 in your post)

It was just because my scope was on RB3 instead of RB0 !!!
I'm so sorry i was sure pwm pin was RB3. (as i said on my first post)

Anyway all is working fine now ( since the beginning in fact ! )

Thanks again
Xavier
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