home *** CD-ROM | disk | FTP | other *** search
/ Fish 'n' More 2 / fishmore-publicdomainlibraryvol.ii1991xetec.iso / dirs / stopwatch_466.lzh / StopWatch / StopWatch.doc < prev    next >
Text File  |  1991-03-08  |  10KB  |  207 lines

  1.  
  2.                  StopWatch V2.0 by Christian Danner 23/02/91
  3.  
  4.                               DOCUMENTATION
  5.                               =============
  6.  
  7.                                PRINCIPLES
  8.  
  9. "StopWatch" is a stop watch application, which makes a programmable precision
  10. of  more  than  the  by the system time offered 1/50 second possible  (with a
  11. standard  Amiga 500/1000/2000  e.g.  a resolution of one millisecond occupies
  12. only little processor time,  with a turbo board this value can furthermore be
  13. increased).
  14.  
  15. The  program  reacts  on  the  status  of  the  joystick  button, that  means
  16. connecting  Pin 6  with  Pin 8  of  the  joystick  plug  triggers  the timer.
  17. It  gets  its timebase from the CIA B timer A and in the last resort from the
  18. 7.16 MHz system frequency via interrupt programming.  After many  - by reason
  19. of inaccuracy -  frustrating  experiments with the CIA A timer A, which ought
  20. to be the only one available for free access  according to the Addison Wesley
  21. Hardware  Manual  and  other  publications,  I  used this pretendedly by EXEC
  22. continuously  occupated  timer.  Til  now  no  incompatibilities occured. The
  23. interrupt priority level 6  prevents  the timer program from being overrun by
  24. other interrupts and guarantees a high degree of precision.
  25.  
  26. I tested the program on different conditions.  During car races  I'm using it
  27. in  the  background,  where  the  input  data  come from a hardware interface
  28. producing  a short circuit to the according joystick port wires when the time
  29. measurement beam  of  a  light barrier  is  interrupted.  At  the same time a
  30. Superbase application is running on this machine, doing IO with another Amiga
  31. via  the  serial device  for displaying the score lists and serving a printer
  32. connected to the parallel port.  In comparison with a professional stop watch
  33. running  simultaneously,  I couldn't find out any difference in the resulting
  34. times. Corresponding to my tests, normal Intuition interfacing, file handling
  35. etc.  might not corrupt the timer.  So far I only found one program,  a sound
  36. generator, which caused deviations.
  37.  
  38.  
  39.                                FEATURES
  40.  
  41. The  program  displays  the  single lap times and the total times in a window
  42. on  the  Workbench screen.  You can determine the number of laps per race and
  43. the  period  of  time,  where  no  incoming signal is processed after a valid
  44. event.  In  an  uncomplicated  manner  you can adjust the measurement on your
  45. equipment (I have not yet tested, whether it's necessary or not, but it might
  46. be  required  depending  on  the quartz base).  Optionally for the purpose of
  47. transmitting  the  results to other applications,  the data can be saved to a
  48. disk file in ASCII-format.  You can specify the filename freely,  a selection
  49. between only saving total times or saving all lap-times is possible,  just as
  50. you  can  choose whether the file only has to contain the last time or a time
  51. list shall be generated. Also an ARexx-port for remote control with parameter
  52. modification and a more comfortable result handling is implemented.
  53.  
  54.  
  55.                                CALIBRATION
  56.  
  57. First  You  have  to  select  the  resolution  of  the  timer,   which  means
  58. the  frequency  of  timer  incrementation  (e.g.  1000  for  a  resolution of
  59. 1/1000 second).  This  value should not be excessively high,  because You can
  60. slow down the system rapidely by the timer interrupts.
  61.  
  62. Now You have to tune the timer by changing the  VIACYCL-Values  ("VIA-Cycles/
  63. Timercycle" in the Workbench window),  so that the resulting times are mostly
  64. valid in comparison  with  another  stopwatch.  Doing this,  the "Correction-
  65. factor" has to be 0.
  66.  
  67. For a fine adjustment a correction factor can be defined, which is equivalent
  68. to  the  time deviation devided by the total period of time where it occured.
  69. To  be  able to supervise this adjustment,  the resulting correction value is
  70. displayed  in terms of milliseconds with every measurement in the last of the
  71. three columns.
  72.  
  73.  
  74.                                PARAMETERS
  75.  
  76. All the parameters can be transmitted to the program when starting it. I have
  77. implemented  certain  commands  for the  startup from the CLI,  ToolTypes for
  78. running "StopWatch" from the  WorkBench  and  Rexx-commands  to influence the
  79. already started application.
  80.  
  81. ToolType             CLI   PrgWindow        Explanation
  82. ---------------------------------------------------------------------------
  83. LAPS=number          -l..  Number of Laps   number of laps per race
  84. REFRACT=number       -r..  Refract.-Time    refraction after a pass
  85. CYCLSEC=number       -s..  Resolution       number of timercycles per second
  86. CORRECT=±number      -c..  Correctionfactor timer fine tuning factor [* 1E-6]
  87. VIACYCL=number       -v..  VIA-Cycles / Ti. coarse tuning of the timer
  88. DISPLAY=number       -d    not implemented  number of result lines in display
  89. FILE=path/filename   -f..  not implemented  filename for saving the results
  90. APPEND=ON            -a    not implemented  generate result-list
  91. PASS=ON              -p    not implemented  save also lap-times
  92.  
  93. Valid data range:    LAPS            1 .. 99999
  94.                      REFRACT         1 .. 99999
  95.                      CYCLSEC         1 .. 50000
  96.                      CORRECT     -9999 .. 99999
  97.                      VIACYCL        50 .. 10000
  98.                      DISPLAY         2 ..    12
  99.  
  100. Note:   A VIACYCL-value < 150 may freeze a system without accelerator card by
  101.         occupancy of a  great  amount  of  calculating  time for handling the
  102.         timer interrupts! You could check this with a performance monitor.
  103.  
  104. Example for CLI-Startup:
  105.         StopWatch -l2 -r500 -s1000 -v708 -c-525 -fCLIPS:TimeList -p -a -d5
  106.  
  107. To  modify the parameters in the Workbench window  you first have to click on
  108. the "STATE"-button or to select the pulldown menu "Project/Parameters".  Then
  109. a modification of the values in the  parameter field  is possible.  When done
  110. click  on  the  same  button  again.  This sets the new values and zeroes the
  111. timer.
  112. A  reset  also  can  be  processed simply by selecting the according pulldown
  113. menu.
  114. The state of the system is displayed in an area above the "STATE"-Button.
  115.  
  116.  
  117.                                REXX-COMMANDS
  118.  
  119. The  ARexx-port  of "StopWatch" can be accessed via its name "RexxStopWatch".
  120.  
  121. So far the following commands are implemented:
  122.     CLOSE, RESET, GETTOTAL, GETLAP, GETSINGLE,
  123.     LAPS, REFRACT, CYCLSEC, CORRECT, VIACYCL.
  124.  
  125. CLOSE       ends the program.
  126. RESET       resets the timer.
  127. GETTOTAL    transmits the next total time.
  128. GETLAP      transmits the next additive lap time.
  129. GETSINGLE   transmits the next single lap time.
  130.  
  131. The  purpose  of the  other  commands  to  modify the  parameters  is already
  132. described.
  133.  
  134. The abortion of GETTOTAL, GETLAP or GETSINGLE with "Abort RexxCmd" returns an
  135. error level 10 in RC.
  136.  
  137. Example:
  138.     /* RexxStopWatch */
  139.     ADDRESS COMMAND "Run StopWatch -d10" /* Starting StopWatch */
  140.     ADDRESS COMMAND "Wait 2 Sec"
  141.     ADDRESS "RexxStopWatch"              /* Selection of the Rexx-port */
  142.     OPTIONS RESULTS
  143.     LAPS 4                               /* Modifying the parameters */
  144.     VIACYCL 708                          /*   coarse tuning */
  145.     CORRECT "-525"                       /*   fine tuning */
  146.     CYCLSEC 1000                         /*   resolution 1/1000 sec. */
  147.     REFRACT 500                          /*   refraction 500 * resolution */
  148.     GETLAP                               /* Get next additive lap time */
  149.     IF RC = 0 THEN
  150.         SAY "LAP  : "RESULT
  151.       ELSE
  152.         SAY "ERROR: "RC
  153.     GETLAP                               /* Get next additive lap time */
  154.     IF RC = 0 THEN
  155.         SAY "LAP  : "RESULT
  156.       ELSE
  157.         SAY "ERROR: "RC
  158.     RESET                                /* A reset of the timer */
  159.     GETSINGLE                            /* Get next single lap time */
  160.     IF RC = 0 THEN
  161.         SAY "SINGL: "RESULT
  162.       ELSE
  163.         SAY "ERROR: "RC
  164.     GETSINGLE                            /* Get next single lap time */
  165.     IF RC = 0 THEN
  166.         SAY "SINGL: "RESULT
  167.       ELSE
  168.         SAY "ERROR: "RC
  169.     LAPS 2                               /* Modifying laps per race, reset */
  170.     GETTOTAL                             /* Get next total time */
  171.     IF RC = 0 THEN
  172.         SAY "TOTAL: "RESULT
  173.       ELSE
  174.         SAY "ERROR: "RC
  175.     CLOSE                                /* Ending the program */
  176.     EXIT
  177.  
  178.  
  179.                                IMPLEMENTATION
  180.  
  181. Most  of  the  code  is  written  in  M2Amiga Modula 2 V3.1d  (really antique
  182. version)  by  AMSoft.  I have implemented the interrupt routines in assembler
  183. using  the  Data Becker  Profimat-Assembler  (may be there are  better ones).
  184. Thanks to CygnusSoft for their excellent editor,  which helped me to keep the
  185. source together.
  186. This release already supports different Workbench fonts. Thus I hope, it will
  187. run correctly under AmigaDOS 2.0.
  188.  
  189.  
  190.                                COPYRIGHT
  191.  
  192. Copyright (c) 1991 by Christian Danner.  This program may only be distributed
  193. on non-commercial base together with this documentation file.  It  may not be
  194. distibuted  on  commercial base without my explicit permission.  When you use
  195. this  program most frequently,  especially in a professional manner,  I won't
  196. refuse a little fee.
  197.  
  198. For  further improvements please let me know of all the bugs you find and all
  199. the options you miss.
  200.  
  201.  
  202. My address:    Christian Danner
  203.                Rißkopfstraße 10
  204.                8106 Oberau
  205.                Germany
  206.                Phone: 08824/8122
  207.