home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #1 / NN_1993_1.iso / spool / comp / os / msdos / programm / 11796 < prev    next >
Encoding:
Text File  |  1993-01-04  |  1.9 KB  |  38 lines

  1. Newsgroups: comp.os.msdos.programmer
  2. Path: sparky!uunet!gatech!europa.asd.contel.com!awds.imsd.contel.com!llyene!jato!math.jpl.nasa.gov!vsnyder
  3. From: vsnyder@math.jpl.nasa.gov (Van Snyder)
  4. Subject: What is the timer chip clock rate?
  5. Message-ID: <1993Jan5.005713.13892@jato.jpl.nasa.gov>
  6. Sender: nobody@jato.jpl.nasa.gov
  7. Nntp-Posting-Host: math.jpl.nasa.gov
  8. Organization: Jet Propulsion Laboratory
  9. Date: Tue, 5 Jan 1993 00:57:13 GMT
  10. Lines: 26
  11.  
  12. In the process of writing a routine to get high-resolution times from the PC's
  13. timer chip, I wondered at the weird clock rate for the timer chip: 1.193180
  14. Mhz.  Is that right?  If the clock rate were 1.193046 Mhz, the low-speed
  15. counter at 040:06eH would tick once per hour.  At 1.193180 Mhz, it ticks about
  16. 1/2 second early (65536*65536/1193180 ~= 3599.597, 65536*65536/1193046 ~=
  17. 3600.001), or about 6 us early per interrupt (65536/1193046-65536/1193180),
  18. assuming overflow of the medium-speed counter at 040:06cH is intended to tick
  19. the low-speed counter at 040:06eH once per hour.
  20.  
  21. The counter in the timer runs continuously, that is, it doesn't stop when it
  22. generates an interrupt and wait to be restarted, so it doesn't seem reasonable
  23. that the approximately 6 us per interrupt are to allow for interrupt processing.
  24.  
  25. Also, it seems the only thing one can do if one detects that the timer
  26. overflow interrupt pending bit is set in the peripheral interrupt controller
  27. (PIC 0, bit 0) is to pretend the count in the timer chip is 0.  If you
  28. enable interrupts, do a few NOP's, and start over (which disables
  29. interrupts), or keep track of the presence or absence of overflow, and add
  30. that onto the reported medium-speed counter (with carry into the reported
  31. value from the low-speed counter), the clock occasionally appears to
  32. run backward by about 20 ms.
  33.  
  34. Any ideas.
  35. -- 
  36. What fraction of Americans believe   |  Van Snyder
  37. Wrestling is real and NASA is fake?  |  vsnyder@math.jpl.nasa.gov
  38.