Recent

Author Topic: TLazSerial : serial port component for Lazarus (windows and linux).  (Read 342710 times)

tr_escape

  • Sr. Member
  • ****
  • Posts: 432
  • sector name toys | respect to spectre
    • Github:
Re: TLazSerial : serial port component for Lazarus (windows and linux).
« Reply #240 on: May 29, 2018, 02:55:34 pm »
It seems that I'm not able to use Lazserial because of the slowness.

Because Rs232 has limits , actually 115200 ~ about 230000bps good enough for a lot of operations.

Maybe you can use another bus system like as ethernet.

« Last Edit: May 29, 2018, 02:57:14 pm by tr_escape »

Thaddy

  • Hero Member
  • *****
  • Posts: 14201
  • Probably until I exterminate Putin.
Re: TLazSerial : serial port component for Lazarus (windows and linux).
« Reply #241 on: May 29, 2018, 03:49:02 pm »
Because Rs232 has limits , actually 115200 ~ about 230000bps good enough for a lot of operations.
That's not correct. The standard is a protocol, not a speed limitation< grumpy, very grumpy  >:D >:D >
before you answer make sure your facts are correct. https://en.wikipedia.org/wiki/RS-232
Specialize a type, not a var.

JJJ

  • New Member
  • *
  • Posts: 20
Re: TLazSerial : serial port component for Lazarus (windows and linux).
« Reply #242 on: May 29, 2018, 03:53:54 pm »
I am using 115200 bps. I have an old software made with CVI and it works. I tested this with Delphi 7 and it worked as well. For some reason I have to add more than 10ms delay between the packets if I am reading the data in Lazarus. Weird.

Jurassic Pork

  • Hero Member
  • *****
  • Posts: 1228
Re: TLazSerial : serial port component for Lazarus (windows and linux).
« Reply #243 on: May 29, 2018, 06:30:28 pm »
hello,
JJJ, you can try to use the recvTerminated  function :
Quote
function RecvTerminated(Timeout: Integer; const Terminator: AnsiString): AnsiString; virtual;
This method waits until a terminated data string is received. This string is terminated by the Terminator string. The resulting string is returned without this termination string! If no data is received within the Timeout (in milliseconds) period, LastError is set to ErrTimeout.

with something like that :
Code: Pascal  [Select][+][-]
  1. procedure TFMain.SerialRxData2(Sender: TObject);      
  2.  var Str : string;
  3. begin
  4.   // you must adjust the timeout value for your case
  5.   Str :=  Serial.RecvTerminated(100,'A'));
  6.   if Serial.SynSer.LastError = 0 then
  7.   begin
  8.     Memo.Lines.BeginUpdate;
  9.     Memo.Lines.Add(Str);
  10.      Memo.Lines.EndUpdate;
  11.     Memo.SelStart := Length(Memo.Lines.Text)-1;
  12.     Memo.SelLength:=0;
  13.   end
  14.   Else
  15.     begin
  16.        Memo.Lines.Add('Error : ' + Serial.SynSer.LastErrorDesc);
  17.     end;
  18.   end;

Friendly, J.P
« Last Edit: May 29, 2018, 06:33:15 pm by Jurassic Pork »
Jurassic computer : Sinclair ZX81 - Zilog Z80A à 3,25 MHz - RAM 1 Ko - ROM 8 Ko

JJJ

  • New Member
  • *
  • Posts: 20
Re: TLazSerial : serial port component for Lazarus (windows and linux).
« Reply #244 on: May 29, 2018, 08:23:30 pm »
Thanks J.P!! It works.


tr_escape

  • Sr. Member
  • ****
  • Posts: 432
  • sector name toys | respect to spectre
    • Github:
Re: TLazSerial : serial port component for Lazarus (windows and linux).
« Reply #245 on: May 30, 2018, 07:31:23 am »
Because Rs232 has limits , actually 115200 ~ about 230000bps good enough for a lot of operations.
That's not correct. The standard is a protocol, not a speed limitation< grumpy, very grumpy  >:D >:D >
before you answer make sure your facts are correct. https://en.wikipedia.org/wiki/RS-232

Yes, thank you for your correction... I mean today's devices has got some limits thats what I said :)

If your device designed to capture the square waves you may speed up to nearly light speed.

« Last Edit: May 30, 2018, 07:41:38 am by tr_escape »

jb007

  • Full Member
  • ***
  • Posts: 145
Re: TLazSerial : serial port component for Lazarus (windows and linux).
« Reply #246 on: May 30, 2018, 11:27:50 am »
Hi, have been away for a while...


Just installed Lazarus again and installed the TLazSerial-master.

With a quick test by compiling/running/debugging the orginal aplication 'sertest' ( that G{S Simulator 2.0 ).
No errors while compiling!

But my own aplication, gives compile error: 





















to DIY or not to DIY

jb007

  • Full Member
  • ***
  • Posts: 145
Re: TLazSerial : serial port component for Lazarus (windows and linux).
« Reply #247 on: May 30, 2018, 11:41:48 am »
Her you can see the directeries:

to DIY or not to DIY

tr_escape

  • Sr. Member
  • ****
  • Posts: 432
  • sector name toys | respect to spectre
    • Github:
Re: TLazSerial : serial port component for Lazarus (windows and linux).
« Reply #248 on: May 30, 2018, 12:14:52 pm »
Maybe some packages missing? Did you try to add laz_synapse in the project inspector?

Jurassic Pork

  • Hero Member
  • *****
  • Posts: 1228
Re: TLazSerial : serial port component for Lazarus (windows and linux).
« Reply #249 on: May 30, 2018, 02:32:44 pm »
hello,
Hi, have been away for a while...
Just installed Lazarus again and installed the TLazSerial-master.

With a quick test by compiling/running/debugging the orginal aplication 'sertest' ( that G{S Simulator 2.0 ).
No errors while compiling!
But my own aplication, gives compile error:

if your application was written with the old version of  the component TLazserial 0.1 , something  has changed in the new version, it is lazsynaser (customized version  of  synaser  for tlazserial include in the package 0.2) in  place of synaser unit which is used.
Code: Pascal  [Select][+][-]
  1. unit Main;
  2.  
  3. {$mode objfpc}{$H+}
  4.  
  5. interface
  6.  
  7. uses
  8.   Classes, SysUtils, LResources, Forms, Controls, Graphics, Dialogs, LazSerial,
  9.   StdCtrls, ExtCtrls, ComCtrls,inifiles,Math,lazsynaser;    
Friendly  J.P
« Last Edit: May 30, 2018, 02:34:15 pm by Jurassic Pork »
Jurassic computer : Sinclair ZX81 - Zilog Z80A à 3,25 MHz - RAM 1 Ko - ROM 8 Ko

jb007

  • Full Member
  • ***
  • Posts: 145
Re: TLazSerial : serial port component for Lazarus (windows and linux).
« Reply #250 on: May 31, 2018, 10:00:41 am »
Thanks, that rings a bell, that whole package story!
Gonna contineu tonight.

Off topic, things have been gone pretty nice, screenshot of my latest ( months ago ) running ".exe file":





« Last Edit: May 31, 2018, 10:08:28 am by jb007 »
to DIY or not to DIY

dimonsky

  • Newbie
  • Posts: 3
Re: TLazSerial : serial port component for Lazarus (windows and linux).
« Reply #251 on: July 01, 2018, 11:22:18 am »
When I install LazSerial on my raspberry, I get a warning:
"The package LazSerialPort 2.0 was marked for installation. Currently Lazarus only supports static linked packages. The real installation needs rebuilding and restarting of Lazarus.
Do you want to rebuild Lazarus now?"
If I press Yes, it tries to compile IDE by itself, but failes in Lazarus.pp, line 150:
"debugln('Lazarus END - cleaning up...');"

WHat I am doing wrong?

Thaddy

  • Hero Member
  • *****
  • Posts: 14201
  • Probably until I exterminate Putin.
Re: TLazSerial : serial port component for Lazarus (windows and linux).
« Reply #252 on: July 01, 2018, 01:31:55 pm »
I do not use lazserial (because it is not visual component and synaser us easier to use from code) but I am installing it now from the online repository. Will Report back.
[back:]
yes it fails big time. Suggest to use the synapse code from 4.1 and write it in code. (That's how I do it all the time. Not that LazSerial is a folly, but my opinion is such things should not be a component and since it is not supported by the author of synapse rather useless except for screen drawers)
You can file a bug report.
« Last Edit: July 01, 2018, 01:37:00 pm by Thaddy »
Specialize a type, not a var.

bobihot

  • New Member
  • *
  • Posts: 35
Re: TLazSerial : serial port component for Lazarus (windows and linux).
« Reply #253 on: August 24, 2018, 01:53:33 pm »
Because now USB-RS TTL/485 converters can to work at high speed, I need possibility to enter directly communication frequency. Because of this I cant find this frequencies in component, but I successfully make transfer of 1-2Mbps. It's good to can choose old standard freq, but and to can enter each desired in style: csDropDown. With Synaser can.

seliman

  • New Member
  • *
  • Posts: 10
Re: TLazSerial : serial port component for Lazarus (windows and linux).
« Reply #254 on: September 16, 2018, 03:31:38 pm »
Hi , My name is Ramiro , sorry my English   I m from Argentina , please can you help me ? .

I try to use the serial component , I send datos from arduino , and I needing to know when this datos its not present , For example

procedure TForm1.SerialRxData(Sender: TObject);

  begin
             
                 str := serial.ReadData;
                 str := AnsiReplaceStr(str, #10, '' ); //saca nueva linea
                 str := AnsiReplaceStr(str, #13, '' );   //saca retorno de carro
                 str := AnsiReplaceStr(str, #32, '' );  // saca linea espacio
             
 
   end;

I needing to know when not have trafic in port , then str = ' '

Thanks in advance

 

TinyPortal © 2005-2018