Recent

Author Topic: TLazSerial: port not really closing  (Read 2096 times)

GeneCode

  • New Member
  • *
  • Posts: 25
  • What is the cost of lies?
TLazSerial: port not really closing
« on: October 04, 2019, 02:02:33 am »
Hi all (and Jurassic Pork  8) )

I am trying to use TLazSerial but the behaviour is not really working well on my Windows 10.
I have version TLazSerial 0.2 and Lazarus v1.8.4

So I have a 'COM4' connected to a device, and I can open other program (putty, etc) on this COM4 just fine. and it closes the port well too.

But when I use TLazSerial, the closing of the port seems to not working despite getting a Status of
'Port \\.\COM4 closed' in the event onStatus. After I press Close button, the port seems to be locked and unable to be accessed by other programs. Also, the application itself hangs and unable to close i had to manually use task manager to terminate it.

Hereby is the zipped program if you wish to test it. Ofc, you need to modify the TLazSerial component's COM number to the device you are connected to in order to test it.

https://easyupload.io/edqt31

Windows 10
Lazarus 1.8.4

avra

  • Hero Member
  • *****
  • Posts: 2514
    • Additional info
Re: TLazSerial: port not really closing
« Reply #1 on: October 04, 2019, 08:27:42 am »
But when I use TLazSerial, the closing of the port seems to not working
5-6 years ago I faced the same problem on one WinXP machine and I couldn't fix it no matter what I tried. That was the moment when I had switched to Synaser. No problems since then. I am sorry to hear that this issue still exists. Do you have latest TLazSerial?
ct2laz - Conversion between Lazarus and CodeTyphon
bithelpers - Bit manipulation for standard types
pasettimino - Siemens S7 PLC lib

tr_escape

  • Sr. Member
  • ****
  • Posts: 432
  • sector name toys | respect to spectre
    • Github:
Re: TLazSerial: port not really closing
« Reply #2 on: October 04, 2019, 10:50:34 am »
It could be com port driver too. What kind port do you using? Maybe you should update your driver.
Other component is the DataPort created by Serbod https://github.com/serbod/dataport

Also it is coming by Online Pack. Manager.

avra

  • Hero Member
  • *****
  • Posts: 2514
    • Additional info
Re: TLazSerial: port not really closing
« Reply #3 on: October 04, 2019, 12:32:06 pm »
It could be com port driver too.
In my case COM port locking stopped after changing serial lib.
ct2laz - Conversion between Lazarus and CodeTyphon
bithelpers - Bit manipulation for standard types
pasettimino - Siemens S7 PLC lib

GeneCode

  • New Member
  • *
  • Posts: 25
  • What is the cost of lies?
Re: TLazSerial: port not really closing
« Reply #4 on: October 07, 2019, 01:57:27 am »
It could be com port driver too. What kind port do you using? Maybe you should update your driver.
Other component is the DataPort created by Serbod https://github.com/serbod/dataport

Also it is coming by Online Pack. Manager.

I downloaded DataPort but I am not sure how to install it.
There is LPK file and when I open and click Add->Install, lazarus recompiled and rebuild and no new packages found.
Sorry I am newbie, not sure how to add TDataPortSerial.
Windows 10
Lazarus 1.8.4

GeneCode

  • New Member
  • *
  • Posts: 25
  • What is the cost of lies?
Re: TLazSerial: port not really closing
« Reply #5 on: October 08, 2019, 03:37:23 am »
I just installed Synaser from synapse. Will try to use this instead.
Windows 10
Lazarus 1.8.4

avra

  • Hero Member
  • *****
  • Posts: 2514
    • Additional info
Re: TLazSerial: port not really closing
« Reply #6 on: October 08, 2019, 11:59:33 am »
I just installed Synaser from synapse.
Besides official web docs you can find a simple example here:
https://wiki.freepascal.org/Hardware_Access#Serial_Communication
ct2laz - Conversion between Lazarus and CodeTyphon
bithelpers - Bit manipulation for standard types
pasettimino - Siemens S7 PLC lib

GeneCode

  • New Member
  • *
  • Posts: 25
  • What is the cost of lies?
Re: TLazSerial: port not really closing
« Reply #7 on: October 11, 2019, 09:45:22 am »
I just installed Synaser from synapse.
Besides official web docs you can find a simple example here:
https://wiki.freepascal.org/Hardware_Access#Serial_Communication

Thanks for the link. I tried Synaser but can't even send a simple $aa or $11
i am getting weird bytes at the other machine.

But from that link, i saw FPC serial. Seems so easy to use that instead. and it works for me!
Windows 10
Lazarus 1.8.4

 

TinyPortal © 2005-2018