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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
01/29/09 13:54
Read: times


 
#161818 - It's the math that doesn't seem to work
Responding to: ???'s previous message
Here is the whole case mathematically, if someone could explain what basic understanding I'm missing.

Frequency of core clock 12.58 MIPS
Clock offset at initialization 0x6700 = 26368
16 bit register max value = 65535
65535 - 26368 = 39167
So the timer register can only be incremented 39167 before each interrupt occurs. TH2-TL2 are incremented once per clock cycle.
12,580,000/39167 = ~321 which suggests to me that 321 interrupts should happen as the register will overflow and, as I currently understand it, the RCAP2L & RCAP2H values are restored into TL2 and TH2 respectively after each interrupt thus guaranteeing a consistent offset.

There is a comment in the sample code that is as follows(fyi an LED lights up at each interrupt):

//Flashed LED on P3.4 approx. every 20Hz

This comment seems to suggest only 20 interrupts per 12,580,000 clock cycles, which indicates 12.58M/20 = 629,000 cycles is occurring between each overflow. Even if these values are divided by 2 (to accomodate a clock cycle being 2 for high/low transition) the numbers don't work out. See the data sheet starting on pg. 75

http://www.analog.com/static/imported-files/Data_Sheets/ADUC845_847_848.pdf

precise understanding and control of the timer in this application is important. What am I misunderstanding here?

List of 12 messages in thread
TopicAuthorDate
ADUC845 Timer2 Control Basics            01/01/70 00:00      
   Well well...            01/01/70 00:00      
   I'm guessing you already know..            01/01/70 00:00      
      Doesn't clarify why that value            01/01/70 00:00      
         the absolute duration of one timer tick...            01/01/70 00:00      
            not important, but what is            01/01/70 00:00      
            The timer tutorial was not helpful            01/01/70 00:00      
   It's the math that doesn't seem to work            01/01/70 00:00      
      321 Interrupts            01/01/70 00:00      
         Experimental path probably best            01/01/70 00:00      
      BTW - XLS Modeling            01/01/70 00:00      
         Timer counters connected to PLL            01/01/70 00:00      

Back to Subject List