Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.3 4.3bsd-beta 6/6/85; site cbmvax.cbmvax.cbm.UUCP Path: utzoo!watmath!clyde!cbosgd!ukma!psuvm.bitnet!psuvax1!vu-vlsi!cbmvax!randy From: randy@cbmvax.cbm.UUCP (Randy Weiner) Newsgroups: net.micro.amiga Subject: Re: Clarifications for the Ultra Fast Timer Message-ID: <299@cbmvax.cbmvax.cbm.UUCP> Date: Wed, 28-May-86 09:21:17 EDT Article-I.D.: cbmvax.299 Posted: Wed May 28 09:21:17 1986 Date-Received: Fri, 30-May-86 06:51:33 EDT References: <724@watcgl.UUCP> Reply-To: randy@cbmvax.UUCP (Randy Weiner) Distribution: net Organization: Commodore Technology, West Chester, PA Lines: 66 In article <724@watcgl.UUCP> fdfishman@watcgl.UUCP (Flynn D. Fishman) writes: I have removed most of the article... now to get on to the heart of the matter. > >I have some questions now: I am in the infansy of my C learning, could >someone please explain to me about the busy wait. > Busy-wait is the technique where your program loops forever until some condition is met. Typically, you would test the state of some variable to determine when to exit your loop. In a real-world situation, you would also want some kind of time-out that would force you to exit the loop after some period of time, otherwise you are hung. In terms of the Amiga Exec, a busy wait might consist of sending a command to an IO device, then checking its status with a CheckIO(), looping until the IO has completed. Busy-wait is NOT a recommended programming technique on the Amiga. Mostly because it is a waste of CPU time, and secondly, if you have spawned other tasks (or processes), they will not get a chance to run since your task is hogging all the time for itself. Instead, you should take advantage of the message facilities of the exec and Wait(), or WaitIO() for a desired set of signals, or messages from cooperating tasks, and/or devices. I refer you to the Rom Kernal Manual for more information. Look at the sections on Messages and Ports, chapter 1. many examples which use this technique. > Does anybody know where the Amiga micro-second timer is? I have the manuals The micro-second timer is just the normal timer device opened in microhertz mode. Refer to RKM, starting on page 3-29. The last paragraph refers to the MICROHZ timer. But then, this does not really apply to your application. You need to determine the interval between two events. The Amiga timer device is basically a delay timer. There is no easy way to accurately time an interval to a +/- 1 microsecond accuracy. I refer you to Volume 2 of the RKM, page B-82: the microhertz timer "has a precision down to about 2 microseconds, but will drift at system load increases. The timer is typically accurate to within 5%" Have you considered reading the system time and using time arithmetic to get the interval. The only problem is that this will not provide a 1 or 2 microsecond resolution, and is probably not repeatable, either. >>The interrupt interfacing will have to be done in assembly. > >I was afraid someone would say that. I just (am still) learning C, I hope >someone can come up with some ideas (in C preferably) > While it is possible to do an interrupt interface in C, it will depend on your specific requirements. Using C will incur quite a bit more overhead than if using assembler. -- + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Randy Weiner -- Commodore Business Machines <> uucp: {ihnp4|seismo|caip}!cbmvax!randy arpa: cbmvax!randy@seismo (or) randy@cbmvax.UUCP@{seismo | harvard} TEL: 215-431-9180