On Sun, 09 Sep 2018 13:33:22 +0200, Bo Berglund via Lazarus <lazarus@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 >described here: >http://wiki.freepascal.org/Hardware_Access#FPC_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: > >str(ComPortNr,tmpstr); >ComPortName:= 'COM'+tmpstr+':'; >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. -- Bo Berglund Developer in Sweden -- _______________________________________________ Lazarus mailing list Lazarus@lists.lazarus-ide.org https://lists.lazarus-ide.org/listinfo/lazarus