|
|
View previous topic :: View next topic |
Author |
Message |
will
Joined: 28 May 2012 Posts: 24 Location: france
|
timer1 |
Posted: Thu May 31, 2012 5:07 am |
|
|
hello,
I use timer1, I test by a toggle on LED. but they say I can not fit inside. The LED blinks once, then nothing.
Someone can help me implement this timer1. The timer0 operates.
Thank you
[
Last edited by will on Mon Jun 11, 2012 4:19 am; edited 1 time in total |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19539
|
|
Posted: Thu May 31, 2012 7:25 am |
|
|
You still have the problem that Timer0, will be taking all the spare processor time. You do understand, that it takes _time_ to get into and out of an interrupt?. Typically 60 instructions. Your timer0, is trying to execute every 255 instructions. Depending on how much code you have in the timer0 'mot_generation_pwm' routine, there is going to be little time left for the processor to do anything else.
Seriously, this is why there is PWM _hardware_, because trying to do fast PWM's via software routines, uses too much processor time....
As setup, timer1, has a lower priority than timer0 (by default priorities are assigned in the order the interrupts are declared), so it may well only get called rarely if at all....
However your problem may be much simpler. What current limiting resistor have you got on the LED?. If this is not at least perhaps 100R, then you may well have the 'read modify write' problem (RMW - search here).
Best Wishes |
|
|
will
Joined: 28 May 2012 Posts: 24 Location: france
|
|
Posted: Thu May 31, 2012 8:59 am |
|
|
It was indeed a problem of RMW.
It works.
Thank you very much. |
|
|
|
|
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
|