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

16F1937 and PWM [solved]

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



Joined: 21 Nov 2003
Posts: 200

View user's profile Send private message

16F1937 and PWM [solved]
PostPosted: Fri Aug 19, 2011 9:58 am     Reply with quote

I am having issues with the PWM on this part. I have used PWM on many other parts. I don't really care about the frequency right now just trying to get something working.

Compiler 4.124

I am setting the timer 2 setting up the CCP4 and setting the duty just like always. Is there something I am missing here?
Code:

setup_ccp4(CCP_PWM | CCP_TIMER2);
setup_timer_2(T2_DIV_BY_1, 0x33,1);
setup_comparator(NC_NC_NC_NC);
setup_oscillator(OSC_8MHZ);
enable_interrupts(GLOBAL);
set_pwm4_duty(512);
curt2go



Joined: 21 Nov 2003
Posts: 200

View user's profile Send private message

PostPosted: Fri Aug 19, 2011 10:57 am     Reply with quote

Update... I am able to get PWM1 running.. so the trouble is with PWM4. Let me know if anyone has some thoughts.
curt2go



Joined: 21 Nov 2003
Posts: 200

View user's profile Send private message

PostPosted: Fri Aug 19, 2011 12:03 pm     Reply with quote

Problem solved! The CCS compliler is not setting thr TRISD bit properly in the setup_ccp4. So I have to do it manually.

Hopefully this will get fixed in an update.
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