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

Stopping a PWM?

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








Stopping a PWM?
PostPosted: Wed Nov 26, 2008 8:20 am     Reply with quote

Hi

Is this the same as the CCP1 pin will be "L"?
set_pwm1_duty(0);

Ask because it dont?
Ttelmah
Guest







PostPosted: Wed Nov 26, 2008 8:41 am     Reply with quote

You need:

set_pwm1_duty(0L);

Note the 'L'.
The PWM, has a ten bit resolution. The 'set_pwm_duty' function, needs to receive a 'long' value, to access all ten bits. If you only give it a 'short' value (the '0' in your original command), then only the upper 8bits of the PWM, will be accessed. _If_ the two low bits have been set to a non zero number (as will have happened if you have output any 'long' value to the PWM), then these will still be set, and you will get a tiny pulse of 1,2, or 3 PWM clocks.

Best Wishes
Guest








PostPosted: Wed Nov 26, 2008 10:53 am     Reply with quote

Very Happy
asmboy



Joined: 20 Nov 2007
Posts: 2128
Location: albany ny

View user's profile Send private message AIM Address

PostPosted: Wed Nov 26, 2008 4:44 pm     Reply with quote

And 2 more cents - if you are using variables to do your PWM work - just remember to use a LONG for calling setPWM
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