From: mauch AT uni-duisburg DOT de (Michael Mauch) Newsgroups: comp.os.msdos.djgpp Subject: Re: timer interrupt - sample code anyone? Date: Wed, 23 Apr 1997 18:32:11 +0200 Organization: Home, sweet home (via Gesamthochschule Duisburg) Lines: 35 Distribution: world Message-ID: <5jldi9$m5o@h20-hrze.uni-duisburg.de> References: <199704221040 DOT MAA11513 AT gilberto DOT physik DOT rwth-aachen DOT de> NNTP-Posting-Host: ppp85.uni-duisburg.de Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk On Tue, 22 Apr 1997 10:40:27 GMT, Christoph Kukulies wrote: > I need a (relatively fine grained) time base and I'm thinking of using > the system timer chip for this purpose. Never programmed that chip > before and never dealt with hardware interrupts under djgpp. > > Can anyone point me to some sample code? The DJGPP FAQ says: >>> check out the example of hooking the timer interrupt, e.g. ftp://ftp.coast.net/Coast/msdos/c/pctime13.zip. <<< But first have a look at the uclock() function mentioned in the libc info file: >>> `uclock' is provided for very high-resulution timing. It is currently accurate to better than 1 microsecond (actually about 840 nanoseconds). <<< > The timer should interrupt at a rate of 10 KHz and the interrupt > service routine is just supposed to increment a global 32 bit value. > > Hope, the 10KHz doesn't bring down the overall system performance. 10kHz interrupt rate sound very hard - most likely it's easier to call uclock() just when you need it instead of incrementing a counter all the time. Regards... Michael