[Lazarus] Usage of Serial in a testing program?

Bo Berglund bo.berglund at gmail.com
Mon Sep 10 15:19:31 CEST 2018

On Sun, 9 Sep 2018 20:44:34 +0000, Mark Morgan Lloyd via Lazarus
<lazarus at lists.lazarus-ide.org> wrote:

>I did quite lot of work on the serial.pp unit more recently than that 
>wiki page, in fact I didn't even know it existed. Please refer to the 
>comments in that file in the first instance.

Thanks Mark,
I did that too and there is stuff I don't find there, like:

Read blocking?
>From interface section:

{ Reads a maximum of "Count" bytes of data into the specified buffer.
  Result: Number of bytes read. }
function SerRead(Handle: TSerialHandle; var Buffer; Count: LongInt):

Does this function read whatever is in the buffer when called up to a
maximum of Count, or does it actually wait until Count bytes have
arrived? If it waits, for how long?

Concerning the com port name for SerOpen():

{ Open the serial device with the given device name, for example:
    \COM1, \COM2 (strictly, \\.\COM1...) for normal serial ports.
    ISDN devices, serial port redirectors/virtualisers etc. normally
    implement names of this form, but refer to your OS documentation.
  Returns "0" if device could not be found }
function SerOpen(const DeviceName: String): TSerialHandle;

In the Wiki example they use COMx: where x is a number, but this is
probably only working for single digit numbers 1..9.
In any case the naming there is not described in serial.pp

I need to huse a high numbered com port since all I have is USB2Serial
dongles, which typically get you a port number like 29...

Bo Berglund
Developer in Sweden

More information about the Lazarus mailing list