Article View: comp.os.msdos.programmer
Article #195Re: Timing Problem
From: aki
Date: Mon, 03 Aug 1992 05:46
Date: Mon, 03 Aug 1992 05:46
26 lines
1709 bytes
1709 bytes
In article <1805.102.uupcb@ssr.com>, dick.zeitlin%acc1bbs@ssr.com (Dick Zeitlin) writes: > JY> . The time should be accurate to at > > .least 10 ms but the clock() function in C and the other time > > .functions I've looked at are only accurate to 55 ms (because > > .it's updated 18.2 ticks/sec). > > Read the timer-0 (or maybe it's timer-1) register at Port 0x40, which is > used to generate that 18.2/sec tick. That register is incremented at > approx. 1.2 mHz. It's a 16 bit register, and should provide sufficient > resolution for your needs. <~> DON'T just go ahead and read it. You need to make sure what you get is the actual time data. This can be done with a simple latch instruction to the timer chip (outp(0x43, 0)). THEN you get the data from I/O 40H in two bytes (LSB first, MSB 2nd). Remember to give the poor chip some time to recover between I/O to the same addr to support those designs that don't automatically add wait states to slow down I/O operations. The accuracy of the timer is 1/1193180 seconds and it should be used with the DOS timer count that's in the BIOS data-area. Aki. -- / Phone: 408-662 9664 Fax: 662 9676 | "Aki" pronounced: Ah-Key. I know \ \ 125 Searidge Ct #D, Aptos, CA 95003 | what I'm doing most of the time. /
Technical Details
Message-ID:
<3987@cruzio.santa-cruz.ca.us>Path:
arc1-ca.pugleaf.net!sparky!uunet!olivea!hal.com!decwrl!csus.edu!netcomsv!cruzio!akiReferences:
<1805.102.uupcb@ssr.com>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!olivea!hal.com!decwrl!csus.edu!netcomsv!cruzio!aki From: aki@cruzio.santa-cruz.ca.us Newsgroups: comp.os.msdos.programmer Subject: Re: Timing Problem Message-ID: <3987@cruzio.santa-cruz.ca.us> Date: 3 Aug 92 05:46:00 GMT References: <1805.102.uupcb@ssr.com> Sender: aki@cruzio.santa-cruz.ca.us Reply-To: aki@cruzio.santa-cruz.ca.us Lines: 26