[Lazarus] Usage of Serial in a testing program?
bo.berglund at gmail.com
Sun Sep 23 10:01:45 CEST 2018
On Sun, 23 Sep 2018 08:39:52 +0200, Bo Berglund via Lazarus
<lazarus at lists.lazarus-ide.org> wrote:
>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
Forgot to add a question regarding making this a cross-platform
If I add a check for the platform inside my program, how sghould it
look like to work on both Windows and Linux?
Something like this:
function TWiFiCommTester.ConnectSerial(Port: byte; Baud: integer):
FLastError := '';
ComPortName:= '\\.\COM' + IntToStr(Port);
//What goes here?
ComPortName := ????
FSerial := SerOpen(ComPortName);
Developer in Sweden
More information about the Lazarus