Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
07/24/06 08:14
Read: times


 
#120909 - problem in timer with a least count of 1 millisec
Sir/mam,
I created two MCB tripping timers(99.99 and 999.9 seconds) prior to this higher resolution timer thats creating problem.These applications had higher least counts of 10 millisecond and 100 milliseconds. They are working accurately.When i adjusted one of these programs for timer with a least count of 1 millisecond, timer has started running slowly.Timimg displayed is slower by 35% than actual time.Microcontoller used is AT89S52.I am posting part of code indicating changes that i made to previous code
of 99.99 timer to obtain 9.999 timer:
/*Explaination of application: Increments count every 1 ms and retains last value on encountering two consecutive zeros at interval of 5 ms at pin P0_0.Starts displaying time from 0.000 when input becomes high again*/

#define MSBreload_value 0xFC
#define LSBreload_value 0x17	//1 ms or .001 sec /*earlier this was intialized in accordanc to 10 msec*/

/*timer 1 interrupt used for four 7-segment displays multiplexing*/
/* timer 2 interrupt used to increment count every 1 msec*/
void inter_2(void) interrupt 5 
{if(P0_0==1)
count1++;
TF2=0;
if((count1%10)==0)
g=3;
}
/*timer 0 used to keep track of two consecutive zeros at interval of 5 milli sec*/
TL0=0x77;TH0=0xEC;//5000micro sec
void inter_0(void) interrupt 1 
{	g++;
}

Please tell me what could be the reason for timer to work slowly when timer overflow's frequency increases. And how to overcom this?
Thanking you in anticipation


List of 17 messages in thread
TopicAuthorDate
problem in timer with a least count of 1 millisec            01/01/70 00:00      
   Code as shown should work methinks            01/01/70 00:00      
      clarifications            01/01/70 00:00      
         atomicity            01/01/70 00:00      
            atomicity problem?            01/01/70 00:00      
               about atomicity            01/01/70 00:00      
   Back to basic            01/01/70 00:00      
      reply to vishal sinha            01/01/70 00:00      
         bible time            01/01/70 00:00      
   Hm ...            01/01/70 00:00      
      reply to Christoph Franck            01/01/70 00:00      
         totally imprecse            01/01/70 00:00      
   What is the size of the variables?            01/01/70 00:00      
   not enough info            01/01/70 00:00      
      other details about code            01/01/70 00:00      
         here you go again            01/01/70 00:00      
         yet questions more            01/01/70 00:00      

Back to Subject List