AnsweredAssumed Answered

ADuC7024 - Clarification of Timer 1&2 hr:min:sec:hundreths format

Question asked by ADUzer on Jan 20, 2012
Latest reply on Feb 3, 2012 by AudeR

Related to this post http://ez.analog.com/message/16168#16168.

 

For the Hr:min:sec:Hundredths format (2 & 3) the data sheet shows the prescale for Timer 2 is 'expected' to be /256. Why is this the case, and what would happen if another setting was used? It is not shown as 'expected' for Timer 1.

 

If a clock source of 32,768Hz was used with a prescale of /256 then a timer 2 value of 0x00000100 would correspond to a true time of 100 x 256 / 32,768 = 0.78sec rather than 1sec.

 

To achieve a true real time count in this mode and prescaler setting would need an external clock source of 256/10ms = 25,600Hz.

 

The post linked earlier seems to suggest setting the prescaler to /32,768 such that a timer 2 value of 0x00000001 would correspond to 1sec and not one hundreth of a second. Similarly a value of 0x00000100 would then be 100sec, and  0x00010000 would be 6,000sec. This all seems counterintuitive to the device supporting a hr:min:sec:hundreths format.

 

 

On this subject, an extract from the WakeUpTimer,c code example from ftp://ftp.analog.com/pub/www/technology/dataConverters/microconverter/source_code.zip for the ADuC7026 is :


  T2CON = 0xE8;         // Configures Timer2 to count down, with
                        // "Hr:Min:Sec:Hundredths" format and prescalar of 256

  T2LD = 0x00010000;    // Sets the counter register to 5 minutes. Format: HH:MM:SS:hh

 

Two observations are :

 

T2CON[10:8] are not configured, so presumably 00 = external crystal, count down.

The T2 value (min = 0x01) is a count of 1 x 60 x 100 = 6,000, but the code comment is  5minutes (300sec).

Outcomes