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

timer1

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



Joined: 28 May 2012
Posts: 24
Location: france

View user's profile Send private message AIM Address

timer1
PostPosted: Thu May 31, 2012 5:07 am     Reply with quote

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: 19538

View user's profile Send private message

PostPosted: Thu May 31, 2012 7:25 am     Reply with quote

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

View user's profile Send private message AIM Address

PostPosted: Thu May 31, 2012 8:59 am     Reply with quote

It was indeed a problem of RMW.
It works.

Thank you very much.
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