[fpc-pascal] Access to RS232 ports with fpc

Holger Bruns holger.bruns at gmx.net
Mon Nov 2 11:42:18 CET 2009

Jonas Maebe schrieb:
> Holger Bruns wrote on Mon, 02 Nov 2009:
>> Martin schrieb:
>>> you can do:
>>> var buffer: Array of byte;
>>> SetLength(Buffer, 1000);
>>> SerRead(Handle, Buffer[0], 1000);
>> I checked this out. It works not reliable. Sometimes I get real data, 
>> sometimes the data are corrupted. I have no idea to rule out 
>> corrupted data.
> You have to check the result of the serread routine. Since it returns 
> the result of the fpread call, "man 2 read" will tell you what those 
> results mean. In short,
> a) result >= 0: actual number of bytes read (the 1000 you pass is just 
> a maximum)
> b) result < 0: an error occurred

Thank you. I checked this out, but every incoming character is 
interpreted as zero, regardless of its real value.


More information about the fpc-pascal mailing list