On Fri, 21 Aug 2020 20:06:04 +0200, Christo Crause via fpc-pascal <fpc-pascal@lists.freepascal.org> wrote:
>In my limited experience the FPC serial unit is a bit more low level than >the components such as synaser etc. There is a bit more of a learning >curve and one needs to decide whether to go blocking or not and how to >handle async reads etc. I needed to use custom baud rates with auto baud >for an application (debugwire-gdb-bridge) so I took the time to figure out >some of the details. >Since then I've re-used it in other serial based >applications - once you get past the learning curve of how things fit >together it is relatively easy (I guess like most things). I prefer it now >because it reduces external dependencies in a project. This is what I am also looking for after having dealt with AsyncPro on Delphi for many years in the beginning of this century. It was never possible to figure out how many of the units one really needed to talk serial... And LazSerial pulls in (unnecessarily) GUI dependencies so it cannot be used in a non-gui application. > >> Seems like there are virtually no posts describing solutions using >> serial... >> > >Here is a unit showing how to open, read and write (blocking) using the >serial unit: >https://github.com/ccrause/debugwire-gdb-bridge/blob/master/serialutils.pas >Unfortunately there is other code for sending a break command and setting >custom baud rates which makes it appear more complicated than it should be. Thank you very much for this! I do not need break or non-standard baudrates so I will cut that away when testing it. Instead I need to add a thread for reading data so I can have an event driven reception of data. It would read available data and fire off a NotifyEvent to handle the incoming data in the main application. -- Bo Berglund Developer in Sweden _______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal