UNIVREL@AUVM.BITNET (05/03/90)
I am trying to time a function that executes in better than '1/100' of a second. I know how to program PC's timer 2, but i don't need its very high resolution. I understand there is a way of programming PC's timer 0 to obtain a resolution higher than that provided by the BIOS clock tick. I would appreciate any adivce from anyone with experience in programming IBM PC/XT/AT's timer 0. Thank you in advance. Sajjad Ahrabi`
tte@metaware.metaware.com (Thuan-Tit Ewe) (05/03/90)
In article <90122.132954UNIVREL@AUVM.BITNET> UNIVREL@AUVM.BITNET writes: >I am trying to time a function that executes in better than '1/100' of a >second. I know how to program PC's timer 2, but i don't need its >very high resolution. I understand there is a way of programming >PC's timer 0 to obtain a resolution higher than that provided by the >BIOS clock tick. > >I would appreciate any adivce from anyone with experience in programming >IBM PC/XT/AT's timer 0. > >Sajjad Ahrabi` Timer 0 is currenly programed to mode 3, (Square wave mode). You pretty well can't read the counter and make use of it. The thing to do is to reprogram the counter to mode 2, (Rate generator); this way when you read the counter, you'll get a downward count from 64K. Along with the BIOS counter in low memory, you'll get a very high resolution timer. Since you didn't mention what you wanted to do with the timer, I'll assume that you may want to speed up the clock interrupt. To do this, program the chip to a lower startup count, but make sure that it is multiple of 2, therefore the chip will interrupt in multiples of 18.2 times a second. At this point, keep an internal counter of the number of times the chip interrupts before chaining to the original interrupt, thereby keeping the correct time and everything else will be dandy. Get the Intel Microsystem Components Handbook and read up on 8254, and good luck. Thanks goes to Roger Cross of HyperWare for explaining the subtleties of the chip to me when I was writing a profiler. -thuan --- Thuan-Tit Ewe MetaWare Inc tte@metaware.com (408) 429-6382 {uunet|ucscc|acad}!metaware!tte
djb@wjh12.harvard.edu (David J. Birnbaum) (05/04/90)
There is a good discussion of reprogramming timer 0 in chapter 2 of Michael Abrash, Zen of Assembly Language, Glenville, Illinois and London: Scott, Foresman and Company, 1990, isbn 0-673-38602-3. --David ============================================================ David J. Birnbaum djb@wjh12.harvard.edu [Internet] djb@harvunxw.bitnet [Bitnet] ============================================================
fayne@Tellabs.COM (Jeffrey Fayne) (05/08/90)
In article <485@wjh12.harvard.edu> djb@wjh12.UUCP (David J. Birnbaum) writes: >There is a good discussion of reprogramming timer 0 in chapter 2 of >Michael Abrash, Zen of Assembly Language, Glenville, Illinois and London: >Scott, Foresman and Company, 1990, isbn 0-673-38602-3. > Just my $.02 : Scott,Foresman and Co is in Glenview, IL not Glenville :) Jeff -- _____________________________________________________________________________ F-14 | _ | | Jeffrey M. Fayne Tomcat | /^ ^\ | | Tellabs, Inc. ____________|_( . )_|____________ | Lisle, IL (708)-512-7726 --*/--|_| (___) |_|--\*-- | fayne@tellabs.com * O O * fjs | Standard Disclaimer Applies _____________________________________________________________________________