|
|
View previous topic :: View next topic |
Author |
Message |
franckcl
Joined: 12 Sep 2003 Posts: 32 Location: France (Paris)
|
set_pwm1_duty : range of the parameter ? |
Posted: Mon Aug 20, 2007 7:20 am |
|
|
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
|
|
Posted: Mon Aug 20, 2007 7:24 am |
|
|
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
|
|
Posted: Mon Aug 20, 2007 7:30 am |
|
|
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 |
|
|
|
|
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
|