[En-Nut-Discussion] Timer resolution....

Ralph Mason ralph.mason at telogis.com
Fri Aug 22 19:30:01 CEST 2003


I have modified the Timer so you can set-up the resolution of the system
clock. (eg number if jiffies per second)

I use 40 in my apps giving a 25ms timer resolution, you can increase or
decrease as necessary.  For 30 ms you could use a value of 100, remembering
ofcourse that you are going to get quite pronounced jitter using the system
timer.

If you need reasonably precise timers you should use one of the remaining
hardware timers.

to use the attached file, you need to define NUT_CPU_FREQ to whatever your
xtal is and change time_base to be whatever you need (number of interrupts
per second)

Hope this is useful.

Ralph



> -----Original Message-----
> From: en-nut-discussion-admin at egnite.de
> [mailto:en-nut-discussion-admin at egnite.de]On Behalf Of Czerteak
> Sent: Friday, 22 August 2003 4:06
> To: en-nut-discussion at egnite.de
> Subject: [En-Nut-Discussion] Timer resolution....
>
>
> Hi,
>
> I was just wondering whether there's an easy way to get better
> system clock
> resolution. Digging through the sources (and experimenting, too)
> brought me
> to the magic number of 62 which seems to be the shortest interval you can
> wait (zero is considered exception). I need to get some data from
> the outside
> through the data/adress bus and send them in the interval of
> 30ms. Whe I use
> NutSleep(30) (or any other number between 1 and 62) it always
> returns after
> 62ms which is too long time period for me. On the other hand,
> send the data
> at maximal speed (about 1ms according to my measuring) is too much.
>
> I know about NutDelay which can be used to achieve that but it
> eats up the
> whole CPU and other threads are frozen which is bad for me, too. :-(
>
> I have a feeling that the clock ticks are interrupt driven. Is
> there a way to
> make these interrupts appear at higher frequency?
>
> Czerteak
>
> P.S.: Thanks for the previous help. The fault was (as usual) on
> my side -> one
> stupid wire was unplugged so the device reacted to more addresses
> than it was
> supposed to... :-(
>
> _______________________________________________
> En-Nut-Discussion mailing list
> En-Nut-Discussion at egnite.de
> http://www.egnite.de/mailman/listinfo/en-nut-discussion
>
> ---
> Incoming mail is certified Virus Free.
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.512 / Virus Database: 309 - Release Date: 19/08/2003
>
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.512 / Virus Database: 309 - Release Date: 19/08/2003
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: timer.c
URL: <http://lists.egnite.de/pipermail/en-nut-discussion/attachments/20030823/a941d692/attachment.c>


More information about the En-Nut-Discussion mailing list