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

set_pwm1_duty : range of the parameter ?

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



Joined: 12 Sep 2003
Posts: 32
Location: France (Paris)

View user's profile Send private message

set_pwm1_duty : range of the parameter ?
PostPosted: Mon Aug 20, 2007 7:20 am     Reply with quote

Hi,

I have a question about the use of the funcion set_pwm1_duty(int value).
What is the range of the value passed into parameter ?
I have tried that :

Code:

unsigned char b;
b=101;
set_pwm1_duty(b);

So for exactly 101, the output is at the maximum !
Why ? it is a 8 bit value so I should have the maximum for 255 ?
(I have tried using a 16 bits variable, and the maximum is for obtained at 404)

Thank you
franck
Ttelmah
Guest







PostPosted: Mon Aug 20, 2007 7:24 am     Reply with quote

The range, depends on what timer2 is set to.
If you setup timer2, with:

setup_timer_2(T2_DIV_BY_1,100,1);

Then the maximum width that can be used is 100. If you chose:

setup_timer_2(T2_DIV_BY_1,255,1);

The output frequency will be just 1/2.55 of the former example, but the count can go to 255.

Best Wishes
Guest








PostPosted: Mon Aug 20, 2007 7:30 am     Reply with quote

Thank you very much for this fast answer Ttelmah !
My timer is set to : setup_timer_2(T2_DIV_BY_16,100,13);

So I anderstand now !
Thank you again, you are a champion !
franck
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