Farzad: The manufacturer of the sensor needs to provide you with documentation on the responses your program can expect. There are no standards on this for serial port communications.
The documentation should also describe how many bytes you can expect to receive for each command, or they may have implemented a protocol. For example, their protocol might require the response packet to start with the number of bytes to follow. Then you could read that value and then read the remaining bytes with a second read command. If the sensor manufacturer didn't do any of this, you throw the sensor away and buy one from a better company! As a last resort you can read one byte at a time in your while loop and set a short timeout value for the serial driver (VISA) Assume that you have read everything if you time out after receiving at least one byte, and end the while loop. Good luck, Jason Dunham SF Industrial Software, Inc. -----Original Message----- From: Farzad [mailto:[EMAIL PROTECTED] Sent: Monday, January 19, 2004 3:37 PM To: [EMAIL PROTECTED] Subject: Read packets Hi all, Hi, I'm trying to communicate with a sensor (Inertial sensor called EiMU) which is connected to my computer through a serial port. The commands which I send are a single byte command, in response to the command the sensor may send packets of different size depending on the request type. How can I know what is the packet size prior to my reading ? Another point is: even if I manually enter the number of bytes to be read, they are mainly sambols. Does anyone have any suggestion of what and how should I convert them to a readable form ? Thank you. __________________________________ Do you Yahoo!? Yahoo! Hotjobs: Enter the "Signing Bonus" Sweepstakes http://hotjobs.sweepstakes.yahoo.com/signingbonus
