home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD2.mdf / c / library / dos / timer / timerhi / timerhi.doc < prev   
Encoding:
Text File  |  1988-05-29  |  2.0 KB  |  43 lines

  1. The machine code module timer.asm contains two functions.
  2. Each function is C compatable in the medium model.
  3. Neither function has any parameters passed to it.
  4.  
  5. prototypes:
  6.     void far time_int(void);
  7.     long int far elaptime(void);
  8.  
  9. the return from elaptime() is a 32 bit value returned in dx:ax (correct
  10. for Microsoft C version 5.0 and QuickBasic 4.0).
  11.  
  12. The value represents the elapsed time since the previous call.  Each count
  13. is 838.2ns (1.19318 mHz clock).  It is assumed that 32 bits will provide
  14. sufficient duration, internally the counting is done to 48 bits.
  15.  
  16. The routines can be called from QuickBasic by declaring the functions
  17. as CDECL (use "." instead of underscore in time_int).  An example of
  18. QB usage is included as TEST.BAS.
  19.  
  20. The routines have been used on IBM PC's, XT's 4.77/8mHz XT clones, 6 mHz
  21. IBM AT's, 6 and 8mHz IBM industrial 7532 (AT like) machines.
  22.  
  23. They depend on the 8253 counter in these machines being at port 040.
  24. The time_int() function modifies the setup of the counters to use pulse 
  25. output rather than square wave output.  This does not seem to have any
  26. effect on the system timing but the user should be on the lookout for
  27. any effects on system time.  Each call to time_int() has the potential to
  28. lose up to 55msec from absolute time because it resets the timer chip
  29. registers to 0 in the process of changing the timer mode.  The time_int()
  30. function need only be called once from a powerup unless some other program
  31. you might use also plays with the timer.  Normally it is called on program
  32. entry.
  33.  
  34. It has been used mainly with a C program that monitors pulse durations by
  35. waiting for an edge of an external signal (brought in via DTR on an COM:
  36. port) and calling deltime() at those points.  These values were then saved
  37. and analysed later.  It is important that the decision measure and program 
  38. path following the decision have the same duration if measure to measure
  39. values are to be consistant.
  40.  
  41.     Michael Walraven (301) 997-8856  [72375,1657]
  42.  
  43.