[fpc-pascal] One experience with the unit serial
Holger Bruns
holger.bruns at gmx.net
Wed Nov 18 14:16:04 CET 2009
Hi,
one more question regarding the unit serial. I use the following
function to get one single byte form a serial port, which has been open
before with seropen:
function getdata(inhandle: tserialhandle; var recdata: char): longint;
begin
fillchar(inbuffer, sizeof(inbuffer), #0);
getdata := serread(inhandle, inbuffer[0], 1);
recdata := inbuffer[0]
end;
I repeat this function as long as I need to read data from a serial
port, byte by byte. One interesting error occurs at the 52478th byte:
serread returns 0 instead of 1. How can I get it work properly?
Best regards, Holger
More information about the fpc-pascal
mailing list