[net.micro.amiga] I need an UltraFast Clock

fdfishman@watcgl.UUCP (Flynn D. Fishman) (05/24/86)

  Ok, here is the problem.

  I am working in C on a project for the psycology department here, and for
this program (in Manx C) I require an ultra fast clock.  The +/- 16.67
milliseconds is not fast enough, they want atleast a microsecond grain
so I can not use VBLANK or MICROHZ.

  I have tried using the current position of the Photon Beam as it scans the
moniter to fine tune VBLANK, and/or MICROHZ, but I find that VHPOSR seems
to be slightly offset from VBLANK and MICROHZ, so that every time the VHPOSR
wraps it changes its relative position to the clock, making timing inaccurate
for longer periods of time.

  I would like to try to avoid having to use only VHPOSR for the timer. 
i.e. counting the number of times the screen has been redrawn and then
calculating the time between events from the number of screen refreshes and
current Y-position.

  And while I am here anyways I have a question about a slightly related 
occurance.  When I read in VHPOSR and do the appropriate boolean to get 
the y-position I find that the series is a nice linear one i.e (1 2 3 4) 
from 1 to 255 except for between 7 and 10 where I get a 0 (i.e. 6 7 0 10)
does anyone know why?

   I would thank anyone in advance for the help on creating this UltraFast
clock, either with the method described above or by some other method.

I also apologize for not thanking some of the people who helped me with my
earlier problems but I am still having trouble emailing out (I will lick that
yet though)
-- 

      FDFISHMAN (Flynn D. Fishman)

UUCP  :	...!{decvax|ihnp4|clyde|allegra|utzoo}!watmath!watcgl!fdfishman   
ARPA  :	fdfishman%watcgl%waterloo.csnet@csnet-relay.arpa 
CSNET :	fdfishman%watcgl@waterloo.csnet

dillon@PAVEPAWS.BERKELEY.EDU (Matt Dillon) (05/26/86)

	I think we need a bit more information.  I would like to pose the
following questions:

	(1) Is this real-time, or can you do the timing operation and 
	process the results later (i.e. not immediately)

	(2) Are these long timing periods (you need +/-1 uS accuracy over
	several seconds)?  or short (Your only clocking intervals of a
	couple of milliseconds)?

	(3) Are you going to be timing continuously, or will there be times
	during which you will not be timing.

Idle question: What in the world do you need +/- 1 uS accuracy for?

---------------------------------------------------------------------

In anycase, to get the resolution you need will CAN be done in C, but will
require disabling interrupts and probably a busy wait of some sort (not 
necessarily over the entire timing period).

To get such accuracy, you will have to go directly to the hardware (as you
seemed to have tried already).  I believe the Amiga has a micro-second
timer, which is normally used by the timer device.  You could confiscate
that, I suppose (it may be a bit tricky), and handle it manually.

* For short time intervals, you would have to use a busy wait.

* For longer time intervals, you can make it interrupt driven, but cause
the interrupts to go off a couple of milliseconds before the actual timeout,
then busy wait the rest of the time.

The interrupt interfacing will have to be done in assembly.


					-Matt