Hello,
amie wrote:
>
> How do I know when I have finished reading data from the serial port??
Reading from the serial port should not be an isolated operation as your
question implies. You should be able to expect what you will be
receiving.
However, in general, every time before reading the data you should check
for the number of bytes available at the serial port. When you feed this
number to the reading operation, all data is read and you are finished
if no error occured, and if you did not ask for more incoming data. You
can check for number of bytes at serial port again, and verify it is
zero.
If you have no control of the incoming data, (i.e you do not send
commands to ask for data), then you should know what the "end of data
identifier" sent by the
transmitting device is. When you recieve it, you
are done.
Husam Abdawi AL-Mosa
Amman-Jordan