avr-gcc-list
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [avr-gcc-list] Problem with timing


From: Theodore A. Roth
Subject: Re: [avr-gcc-list] Problem with timing
Date: Thu, 5 Feb 2004 10:36:42 -0800 (PST)


On Thu, 5 Feb 2004, Juraj wrote:

> Hi Keith, and all!
>
> ms_timer is once set to 0 in definition in timer.c:
> volatile uint32_t ms_timer = 0;
>
> and is incremented by one every 1 milisecond in interupt.
> The main idea was:
> variable ms_timer is 32bit long unsigned, so that max. value is
> 4.29497e+09.
> 4.29497e+09 miliseconds is about 49 days, and because of it, this
> variable never overruns in my application.
>
> Variable ms_timer is used just as real time running in background, and
> its value is used when needed.
>
> I'll try to use compare match, as wrote Andras Nagy.
>
> Thanks all..
>
> Juraj.

Have a look at Brian's implementation. It's not too hard to modify it to
run off of the main cpu clock. He's using a second crystal on TOSC1 and
TOSC2. Here's the link:

  http://www.bdmicro.com/code/hw/src/hw/hw.c

Your code is very similar to Brian's so it might help to compare the two
to get you on your way.

Ted Roth


reply via email to

[Prev in Thread] Current Thread [Next in Thread]