Serial Port Component For Lazarus Come
Serial Port Component For Lazarus Project. 5/13/2017 0 Comments It shows you how to send messages from one PC to another via the serial port. TLazSerial - Serial Port Component for Lazarus (windows and linux).
1.) Thanks for the Lazserial, great work. I wish it would be included in the Laz.distribution package, because the installation needs some hands on. To have it work for me, I needed to point the poject inspector to the location of 'LazSerialPort.pas'. Now the compiler gives me the warning: 'other unit files search path (aka unit path) of. Contains: lararus components Lazserial.
Maybe my fault, since I am an absolute Lazarus newbie(noob). Anyway, it works now, thanks alot again for the great piece of software. 2.) I noticed that I am loosing characters on the RS232, whenever 'Windows-Defender' is running, regardless of UART configuration/speed/workload/etc. Setup: IntelAtom Win10home-32bit with a RS232/USB converter with FT232 chipset. It's not Lazarus(Serial) fault, but is there a workaround?
Hello JP, yes, I 'RTFM', that's how I installed it in LZ1.4.2, after that way of installing it, it gave me when compiling a program the first time an 'LazSerialPort' not found error'. Sorry, I cant remember what it was exactly. That error message went away, only after using the projectinspector. I just removed the path from the projectinspector, voila, now it works without the earlier added path and compiles without any warnings. Again, might have been my mistake (maybe because I tried to use synaser additionally in the 'uses' declaration (sometimes mentioned here in the discussion), what I should not have done/needed).
The FT232 drivers I had been using, were from something beginning 2015, which came with Win10-'Out-Of-The-Box'. I just checked, and you're right, there are newer ones. I just updated to version 2.8.30.0 dated. Now it works perfectly, even without tweaking inside the driver setup, not loosing any characters at all, even with heavy system workload on the weak IntelAtom. Thanks for the hint.
Two more question: Right now, I am using only the OnRxData event for receiving chunks of incoming bytes via LazSerial.ReadData. Is there a way to know, if or which of the byte(s) that I read had frame or parity error(s)? Or will the badly transmitted bytes be skipped and only the OnStatus event be raised? Another thing: When trying to open a none existing COM the debugger raises an exception, when continuing, message says that 'pressing Ok might risk data corruption', normal, or how to avoid that?
Is there some detailed documentation (of the (class)interface) of LazSerial somewhere that I havent found, so I would not bother putting up those (dumb) questions? Thanks again, really appreciated. Greets, AD P.S. My native language is also not english. Hi, tnx for this Lazarus-forum-item. Got the whole stuf compiled/installed/Lazarus-rebuild. My question is: What do I use/need from all the stuff for just an easy RS232-communication between Lazarus and a mikrocontroller.
I don't need that GPS-example. By the way, got my Arduino2560 ( using mikroPAscal ) allready usable for RS232. Using wires: RX and TX. The PC-mikroPascal-IDE-USARTterminal and my Arduino are allready communicating in both ways with a native RSR232-port at my PC and a MAX232-convertor-pcb to my Arduino.
LCD at Arduino is displaying the received string from PC-mikroPAscal-IDE-USARTterminal, and sends it back to PC-mikroPascal-IDE-USARTterminal and displays it. Thanks in advance.
Things're getting better. See the picture added.
All string received perfect, no errors. From time to time I delete the field of incoming strings, by clicking in the field ( memobox). Just to be sure, I don't know much text it can contain. In the code I've modified some thing but another major thing is that I now use the onboard RS232 port. I had some strange acting with the extern-USB-hub with the USB-to-serial-pcbs.
Dont's knowe exactly where the problem is, but from time to the the pc messaged hardware connected/disconnected You know when you're in decive manager and thing begin to pop when connecting/disconnecting hardware. In my case that was COM 4 ( via the USB-hub.usb_to_serial etc etc ) Going to find out what the problem is, later.
Soon I'll strip my code to RS232 comucication only: remove the slide bars etc etc.to get short and clear code and will post it here in zipp. As next i gonna remove the texwritng in the left box, it's been tested, so don't need to see it. Send/receive each 250ms. About the USB serial problems, I found that some USB cables (perhaps most) have unreliable connection of the shell to the shield. The shell is just crimped to the shield over the jacket and eventually the connection becomes unreliable.
Measure resistance from one end to the other, while wiggling the cable near the connector. The gold-flashed cables seem to be the best.
Also, some USB-serial adapters do not do well for closely spaced bytes of data, due to timeout issues. My communication device sends two 8 bit + 1 start + 1 stop bit as a packet, 2400 per second, at 57.6 kB.
Torrent Dragon Ball Z Ultimate Tenkaichi Crack there. So that is 20 bits x 2400 = 48 kB, and only a short period of time between packets. Now the pc-to-Arduino-RS232 is going by the pc-on-board-RS232-port. Programming the Arduino goes via a USB-cable with a virtula-pc-serial-port. ( I had some strange 'reseting'of the Arduino, proberly caused by a cable.
But things deffinitely have improved. No wrong strings received and just occasianly I had an application-hang-up ( in both in Lazarus-Debug-Mode and in Free-Running ) Needs more investigation. More info: Arduino: 115200kbaud/kbps, non-parity, one stopbit. Lazarus: 115200kbaud/kbps, non-parity, one stopbit.
At this moment, pc-sends 6 bytes, Arduino sends 28 bytes: ( say: 8 bits/byte + 1, we round it to 10 ) 115200 / 28x10 = aprox 411 Time of 1 send-period = 1 / 411 = aprox 2,4ms SendingReceiving is done 4 times a second ( delta-T = 250ms ) All regards. I'm very happy I'm this far ow with the whole stuf!
As I have only USB ports on my development machine, is quite common at connecting a serial device that I have to go to the device manager to see in which COM port it was installed. I am developing an application that needs to access a serial device, so I need to get aware of the COM ports installed, either to indicate which to use or to verify the existence of which was already configured.
Researching a bit to not reinvent the wheel, I found this page: which publishes three interesting functions.