Path: utzoo!utgpu!jarvis.csri.toronto.edu!clyde.concordia.ca!mcgill-vision!bloom-beacon!snorkelwacker!think!zaphod.mps.ohio-state.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: <6747@ucdavis.ucdavis.edu> Date: 15 Feb 90 16:19:58 GMT References: <4073@ccncsu.ColoState.EDU> <34253@ucbvax.BERKELEY.EDU> <6711@ucdavis.ucdavis.edu> <1533@smurf.ira.uka.de> Sender: uucp@ucdavis.ucdavis.edu Reply-To: vmrad@pollux (Bernard Littau) Organization: University of California, Davis Lines: 39 In article <1533@smurf.ira.uka.de> urlichs@smurf.ira.uka.de (Matthias Urlichs) writes: >In comp.sys.mac.programmer, article <6711@ucdavis.ucdavis.edu>, > vmrad@pollux (Bernard Littau) writes: >< In article <34253@ucbvax.BERKELEY.EDU> oster@dewey.soe.berkeley.edu.UUCP (David Phillip Oster) writes: >< >< 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. >< >I don't think you need a disk write buffer if you write to the hard disk. >What I did was to call PBRead(serial port, (16 kByte or end of picture)) >asynchronously, call WaitNextEvent with a reasonable timeout (based on the >serial speed, how much you want to read, and how much is already there), and >call PBWrite to your disk file if that call completes. >Allocate a nice big serial buffer (maybe 48k)... As I read your reply, you are doing: SerSetBuf( a 48k buffer) PBRead(serial port, serial port buffer) PBWrite(to disk, serial port buffer) This I am sure will work, once. Maybe more often. It is however very dangerous. The serial port buffer is a circular buffer. You could put yourself in the situation of clobbering your data as you do a PBRead from the serial port buffer to the serial port buffer. If, after you do your PBRead and PBWrite, you always call SerSetBuf before the next character is received, this method would work. This method would not work in the situation asked about by the original poster. The images to be captured are megabytes in size, and there is no ability to pause the data stream to do a flush of the buffer to disk. Bernard Littau VM Radiological Sciences Telephone: (916) 752-4014 School of Veterinary Medicine Internet: vmrad@ucdavis.edu University of California BITNET: vmrad@ucdavis Davis, CA 95616 UUCP: ucbvax!ucdavis!vmrad