Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!cs.utexas.edu!tut.cis.ohio-state.edu!ucbvax!ucdavis!pollux!vmrad From: vmrad@pollux (Bernard Littau) Newsgroups: comp.sys.mac.programmer Subject: Re: For GURU'S Only Message-ID: <6711@ucdavis.ucdavis.edu> Date: 12 Feb 90 20:41:27 GMT References: <4073@ccncsu.ColoState.EDU> <34253@ucbvax.BERKELEY.EDU> Sender: uucp@ucdavis.ucdavis.edu Reply-To: vmrad@pollux (Bernard Littau) Organization: University of California, Davis Lines: 56 In article <34253@ucbvax.BERKELEY.EDU> oster@dewey.soe.berkeley.edu.UUCP (David Phillip Oster) writes: >>1) Can the Mac 2x 16mhz. keep up with this data rate? >Yes. For example, LocalTalk Appletalk uses the serial port at 250K baud >and even a MacPlus can keep up with it. > Appletalk is packet based, and thus is broken into small asynchronous chunks. 250K baud is a burst rate, not a sustained rate. Your answer is still valid, though. Any mac should be able to keep up with this rate. [ ... deleted ...] > >Write a simple application as follows. Set its "can Background" bit in its >SIZE resource so multifinder will give it null events in background. > >Here is what it does: >OpenDriver("\p.Ain") and >OpenDriver("\p.Aout"). >Set the speed of the port to 56k. >Set the serial buffer size to something decently large. There is a 16 bit limit on the size of the serial buffer. The images in question are much larger than 64k byte. >The serial driver will automatically buffer unread characters into its >buffer, in preparation for a read call sometime later. >Now, enter the event loop of your application. Use WaitNextEvent() and >set your application to wake up every second. >at nullEvent time, check, using TickCount() to see if one second has >elapsed. If it has not, do nothing, just loop around back to >WaitNextEvent(). > >If the time has elapsed, check the number of unread characters in the >serial driver's buffer. If it is large and hasn't changed in the last two >seconds, you've got a complete image. FSWrite it to a disk file. >FSRead the serial buffer into itself, or do a KillIO on the serial port to >reset the driver. > This will not work if the image (data in general) is larger than 64k bytes. You will need both the serial buffer and a disk write buffer. In the event loop, read from the serial buffer to the disk write buffer every time through the loop. You must do this at least every 10 seconds or the serial buffer will overflow. The disk write buffer can be as large as memory allows. Bernard Littau VM Radiological Sciences Telephone: (916) 752-0184 School of Veterinary Medicine Internet: vmrad@ucdavis.edu University of California BITNET: vmrad@ucdavis Davis, CA 95616 UUCP: {ucbvax,lll-crg,sdcsvax}!ucdavis!vmrad Bernard Littau VM Radiological Sciences Telephone: (916) 752-0184 School of Veterinary Medicine Internet: vmrad@ucdavis.edu