[Lazarus] Usage of Serial in a testing program?
bo.berglund at gmail.com
Sun Sep 23 08:39:52 CEST 2018
On Sun, 09 Sep 2018 13:33:22 +0200, Bo Berglund via Lazarus
<lazarus at lists.lazarus-ide.org> wrote:
Coming back to this issue after I have been travelling...
>For the serial port handling I found the "built-in" Serial unit
>Now I have a few questions about its usage:
>1) Serial port name
>When opening the port the example does this:
>serialhandle := SerOpen(ComPortName);
>So for say port 29 this results in ComPortName 'COM29:'
>Is this always the case? I have a hunch that for port numbers 1..9 the
>Windows port naming is different than for higher port numbers...
I have now come as far in my application as I can test the way the
Serial unit opens and closes com ports.
It turns out that on Windows there are two port name syntaxes:
Ports 1..9: COM1 to COM9 will work
Ports 10..255: Only \\.\COM10 to \\.\COM255 will work
But one does not need to use different naming depending on the port
number, the second syntax \\.\COMx works also for ports 1..9
Notice that contrary to the wiki example adding a colon to the end
like COM32: does NOT work so that is a wiki error.
I have yet to complete other parts of the application so I don't yet
know if the data flow will wok as expected.
Developer in Sweden
More information about the Lazarus