[En-Nut-Discussion] Timers in Eth board 1.3H

Dusan Ferbas dferbas at etech.cz
Wed Jun 3 10:18:42 CEST 2009


Hi Prasad,

I used a prepared page title to store a code snippet to the NutWiki:
  http://www.ethernut.de/nutwiki/Timer_and_Counter_Interrupts.
This example shows how to setup timer1 for ms periods.

How exact microsecond period you need ?
If not too exact, use following calculations:
number_of_required_counts = 1/(period_ms/1000000)
freq_divisor = 14745600/number_of_required_counts
timer_divisor = 14745600/freq_divisor (rounded value if integer 
arithmetics was used)


#define TIMER1_DIVISOR_20us             14745600/295    //NUT_CPU_FREQ/...
#define TIMER1_DIVISOR_50us             14745600/737

Note: For details look for TCCR1B register description (page 134 - 
135 in ATmega128 data sheet).==========================
 >http://www.ethernut.de/nutwiki/Talk:Nut/OS_Examples

At 12:00 2.6.2009, you wrote:
 >From: <Prasad.Nagapati at infineon.com>
 >Date: Tue, 2 Jun 2009 16:48:37 +0800
 >Hi All,
 >
 >I have many doubts regarding the Timer and counter in the Eth board.
 >Since I am very new to this area (Not the timer and counter :-) but in
 >the board level programming)
 >
 >I want to measure the events in microseconds, so I need a much bigger
 >resolution timer. ...
 >I went in NutWiki but if I click the samples I am not getting any
 >information even though I have logged in.

Dusan  




More information about the En-Nut-Discussion mailing list