fdfishman@watcgl.UUCP (Flynn D. Fishman) (05/27/86)
>I think we need a bit more information. I would like to pose the >following questions: Ok, Matt, and anyone else who wants to tackle this problem. here is some more information I hope it helps. >Idle question: What in the world do you need +/- 1 uS accuracy for? The 1 +/- uS accuraccy is what the boss ordered :-) I was hired by the lab here to work on a project with the psycology department. The prof. is doing an experiment on the analysis of what is seen by the brain (more or less). In his experiment he shows the subject a blob (what else) with a dot somewhere near it. The user (guinne pig) is then expected to press a button depending on the position of the dot (i.e. inside or outside of the blob). It is this period between when the blob is shown and the user press the button that I need accurately timed. >(1) Is this real-time, or can you do the timing operation and >process the results later (i.e. not immediately) If I know some unit of time that has occured between time A and the user pushing a joystick (actually mouse in port 2) I can calculate the real time later. >(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)? Unforunately we are relying on a human input so the time spand can be several seconds, I can not see the time being more than 20 seconds though, (unless the user is a real loser :-) >(3) Are you going to be timing continuously, or will there be times >during which you will not be timing. The timing will be in bursts. How long between the Blob is shown and the user presses a button, I will then draw the next blob (and perform other calculations) and then start the timer again. >...CAN be done in C, but will require disabling interrupts and >probably a busy wait of some sort... >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. I have some questions now: I am in the infansy of my C learning, could someone please explain to me about the busy wait. Does anybody know where the Amiga micro-second timer is? I have the manuals if someone wanted to just tell me the page (if it is present I will look some more) >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) I would also like to thank Matt and the others for the swift and good help I have been getting on the net. -- 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 ****************************************************************************** .... You don't understand? Perhaps I am being to subtle. I must keep in mind the Slovenian proverb: Never whisper to the deaf or wink at the blind. Oh I forgot, you are human, and will consider that rude. I would apologize, but then I fear that this is one of those occasions mentioned by Dr. Johnson on which an apology is rudeness ...... -Racter ******************************************************************************
randy@cbmvax.cbm.UUCP (Randy Weiner) (05/28/86)
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 <<Amiga Technical Support>> uucp: {ihnp4|seismo|caip}!cbmvax!randy arpa: cbmvax!randy@seismo (or) randy@cbmvax.UUCP@{seismo | harvard} TEL: 215-431-9180
stever@videovax.UUCP (Steven E. Rice) (05/29/86)
In article <724@watcgl.UUCP>, Flynn D. Fishman (fdfishman@watcgl.UUCP) writes: > The 1 +/- uS accuraccy is what the boss ordered :-) I was hired by the > lab here to work on a project with the psycology department. The prof. > is doing an experiment on the analysis of what is seen by the brain (more or > less). In his experiment he shows the subject a blob (what else) with a dot > somewhere near it. The user (guinne pig) is then expected to > press a button depending on the position of the dot (i.e. inside or outside > of the blob). It is this period between when the blob is shown and the user > press the button that I need accurately timed. > Unforunately we are relying on a human input so the time spand can > be several seconds, I can not see the time being more than 20 seconds > though, (unless the user is a real loser :-) > The timing will be in bursts. How long between the Blob is shown and the > user presses a button, I will then draw the next blob (and perform other > calculations) and then start the timer again. It sounds as if the specification is unrealistic. . . Given normal human reaction times, the 60 Hz tick should be accurate enough! However, remembering the old maxim that "the boss may not always be right, but he's always the boss," charge ahead. A suggestion, though. Put the timing into a separate unit (e.g., a single-board computer with RS-232C interface, or the like). If you use a very high baud rate for the communication between the AMIGA and the SBC, the starting jitter in the timing will be relatively small (of course, send just a single character to cause it to start timing). Connect the user pushbutton to the SBC, and have that stop the timer. Then the AMIGA can send a request to the SBC (some other character) to get a string containing the timing information. It is in general very difficult to combine multitasking (with its high overhead) with fast real-time response. In cases such as the one you have, separating the functions will be much more effective. Steve Rice ---------------------------------------------------------------------------- {decvax | hplabs | ihnp4 | uw-beaver}!tektronix!videovax!stever
rab@well.UUCP (05/30/86)
(WHAT line ea This whole discussion is silly. You want to time something, use a couple of counter chips and read them with the Amiga. It's utterly ridiculous to try to get accurate timing with anything as powerful as an Amiga. 7400 series logic chips are mind-bogglingly easy to work with, and are certainly a lot more appropriate to the task you have in mind. One microsecond accuracy? In a psychology experiment? Be real. You'll be measuring times in the range of several hundred milleseconds at least; ask the prof. why the hell he needs five-digit accuracy. I bet he doesn't. Probably you'd do just fine with one MILLISECOND accuracy...! -- Robert Bickford {lll-crg,hplabs}!well!rab
dillon@PAVEPAWS.BERKELEY.EDU (Matt Dillon) (05/31/86)
Sorry it took so long to reply to this.... the host I was using as my news machine has been down the last couple of days. I think your prof is going a bit overboard on needing accuracy of +/- 1 uS, especially for a phych experiment. If you *really* need the accuracy, then the best thing to do is to build a small counter circuit which can be read by the Amiga (say, through the parallel port). IT's relitively easy to build the circuit to reset a timer, count , and stop the timer according to some external trigger. The Amiga (or whatever), at it's leisure. I don't think using an Amiga to do the actual timing is appropriate. Apart from the obvious waste of computing resources, the Amiga is geared more to timesharing then realtime jobs. -Matt
mykes@3comvax.UUCP (06/02/86)
In article <1177@well.UUCP> rab@well.UUCP (Bob Bickford) writes: >(WHAT line ea > > One microsecond accuracy? In a psychology experiment? Be real. >You'll be measuring times in the range of several hundred milleseconds >at least; ask the prof. why the hell he needs five-digit accuracy. >I bet he doesn't. Probably you'd do just fine with one MILLISECOND >accuracy...! > > I worked with EEG devices for a while, and from the sounds of the experiment, 1 microsecond is appropriate time slices for acquiring such data. For example, the brain scanner that I worked on (NeuroScience Inc. see the PBS show called the Brain) showed that there were two responses from the brain to a light or pattern shown to a patient. The first response was at the Occipital (sp?) lobe at the base of the skull, and the second was in the cognitive part of the brain. All of this action took place within 120 microseconds (first reponse to second response). This is what makes EEGs work. I do agree that you need external hardware to get that degree of accuracy. The NeuroScience machine had 32 A/D converters monitored by over a half dozen 6809s, which reported the samples back to a master 68000 controller. It took a lot of clock cycle counting and all, but it took only 10 micro- seconds/byte to do a PIA type transfer between a 6809 and a 68000.
derek@gucis.OZ (Derek Austin) (06/04/86)
In article <1177@well.UUCP> rab@well.UUCP (Bob Bickford) writes: > One microsecond accuracy? In a psychology experiment? Be real. >You'll be measuring times in the range of several hundred milleseconds >at least; ask the prof. why the hell he needs five-digit accuracy. >I bet he doesn't. Probably you'd do just fine with one MILLISECOND >accuracy...! If it's behavioural response time from a human you're measuring, millisecond accuracy is fine. However, if you're measuring brain responses, as in say, an auditory perception experiment, microseconds can become important! -- ACSnet: derek@gucis.oz ARPA: derek%gucis.oz@seismo.css.gov CSNET: derek@gucis.oz UUCP: ..!seismo!munnari!gucis.oz!derek JANET: gucis.oz!derek@ukc PHONE: +61 7 275 7682 VIATEL: 737676700 I wish I were a wiggily worm With hairs upon my tummy I'd crawl inside the honey jar And make my tummy yummy!