ereed@leadsv.UUCP (Ed Reed) (11/22/88)
I am having a problem with the FSRead command on a Macintosh II. The problem is as follows: I have three processors, the Mac II, a Force single board computer, and a high speed processor board. The Force is the traffic cop of the system. When the system is running the HSP sends data to a register which the Force reads. The Force then takes that data and sends it to the Mac II. The problem is in order to maintain a realtime system, the Force sends a byte of data to the Mac II every iteration of the control loop. Now FSRead appears to be only getting part of the data. In a test case 0 to 255 was sent from the Force to the Mac II, and approximately every 3rd byte was read. The other bytes where zeroed. Any suggestions. The actual Mac code is: FSRead (InPort, 256, &DataIn); and was written in C using Lightspeed C ver 3.0. Please reply to Joe Hughes Joe Hughes pyramid!leadsv!jhughes
beard@ux1.lbl.gov (Patrick C Beard) (11/26/88)
In article <4793@leadsv.UUCP> ereed@leadsv.UUCP (Ed Reed) writes: > > >I am having a problem with the FSRead command on a Macintosh II. The >problem is as follows: > >I have three processors, the Mac II, a Force single board computer, and a high >speed processor board. The Force is the traffic cop of the system. When the >system is running the HSP sends data to a register which the Force reads. The >Force then takes that data and sends it to the Mac II. The problem is in order >to maintain a realtime system, the Force sends a byte of data to the Mac II >every iteration of the control loop. Now FSRead appears to be only getting part >of the data. In a test case 0 to 255 was sent from the Force to the Mac II, and >approximately every 3rd byte was read. The other bytes where zeroed. Any >suggestions. The actual Mac code is: > >FSRead (InPort, 256, &DataIn); > >and was written in C using Lightspeed C ver 3.0. > >Please reply to Joe Hughes > >Joe Hughes >pyramid!leadsv!jhughes Ack!! and double Ack!! Read Inside Mac carefully! I have used this routine so many times that I always do the code the same way: foo(InPort, DataIn) int InPort; Ptr DataIn; { OSErr err; long bytes_to_read; bytes_to_read=256; err=FSRead(InPort, &bytes_to_read, DataIn); return(err); } The problem with your code is that you aren't passing a pointer to the number of bytes to read. Inside Mac Volume II-92: FSRead(refNum: INTEGER; VAR count: LONGINT; buf: Ptr); In C, one should always interpret a VAR as meaning requiring '&'. I hope this helps. Patrick Beard Lawrence Berkeley Laboratory