Recent

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

allan.brito

  • Newbie
  • Posts: 2
Re: TLazSerial : serial port component for Lazarus (windows and linux).
« Reply #225 on: March 08, 2017, 04:02:07 pm »
Hello Everybody,

I'm using LazSerial and it's very useful, but I'm getting some trouble because I want to receive 15 bytes from a barCode Scanner and I can't get it. In Java I get it because i put that I'm receiving 15 bytes. Can anyone help me in this case? Thanks in Advance.

Thaddy

  • Hero Member
  • *****
  • Posts: 14165
  • Probably until I exterminate Putin.
Re: TLazSerial : serial port component for Lazarus (windows and linux).
« Reply #226 on: March 08, 2017, 04:49:27 pm »
Well. There still isn't an overloaded function ReadData(Size) for that. It is still string instead of buffer of byte, with length... (That's why I don't use it!)
Since "//    function ReadBuffer(var buf; size: integer): integer;"  is not available....
Why? Dunno, I simply ignore LazSerial and use synaser direct. Lazserial is a bit of a hoax anyway.  It hardly adds anything useful. (I am opiniated  ;D :D,don't take that too serious )
« Last Edit: March 08, 2017, 04:54:15 pm by Thaddy »
Specialize a type, not a var.

allan.brito

  • Newbie
  • Posts: 2
Re: TLazSerial : serial port component for Lazarus (windows and linux).
« Reply #227 on: March 08, 2017, 05:35:49 pm »
No problem, I'm new in this language and LazSerial had helped me so much. And Thanks everybody, I get it... I had to disable the RcvLineCRLF and worked well. Thanks.

Stan17

  • Newbie
  • Posts: 6
Re: TLazSerial : serial port component for Lazarus (windows and linux).
« Reply #228 on: April 06, 2017, 10:05:16 am »
Is it supposed to be working under Win 7 64 Lazarus 1.6.4 64?
When I am trying to install the package, I am getting notorious
"CPort.pas(28,1) Fatal: Syntax error, "identifier" expected but "TYPE" found"

Jurassic Pork

  • Hero Member
  • *****
  • Posts: 1228
Re: TLazSerial : serial port component for Lazarus (windows and linux).
« Reply #229 on: April 08, 2017, 03:48:09 am »
hello,
Strange !   :-\  because cport.pas belongs to the comport library not lazserial.

Friendly, J.P
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 #230 on: August 28, 2017, 06:19:36 pm »
Still working at my RS232.

Just got aware that the first position of a char in a Lazarus string is not  [ 0 ]  but  [ 1 ]...

( have done and still do some other languages... :D...so, no wonder... )

Ocasional things went somehow 'semi-ok' but other times totaly messed-up.


Things are improving rappidly and are now stable at all!





« Last Edit: August 28, 2017, 07:36:13 pm by jb007 »
to DIY or not to DIY

jb007

  • Full Member
  • ***
  • Posts: 145
Re: TLazSerial : serial port component for Lazarus (windows and linux).
« Reply #231 on: August 28, 2017, 07:56:37 pm »
hello,
jb007, are you using event or sequential serial port read ?
Can you put your lazarus source code in a zip file in attachment to have a look to your code ?

Friendly, J.P

Tnx.

Past time, I concentraded on learning/coding the Atmega2560 using mikroPascal AVR.

Recently started again at Lazarus RS232. ( in combination with the Arduino 2560 )

I hope to send you the code in a couple of days.

First I want to strip down the code of all unneeded code, to get a better view etc.

Kind regards!












to DIY or not to DIY

jb007

  • Full Member
  • ***
  • Posts: 145
Re: TLazSerial : serial port component for Lazarus (windows and linux).
« Reply #232 on: September 01, 2017, 10:29:17 pm »
For you all: a good weekend!

Cheers!




to DIY or not to DIY

jlopez

  • Newbie
  • Posts: 3
Re: TLazSerial : serial port component for Lazarus (windows and linux).
« Reply #233 on: October 15, 2017, 06:38:57 am »
I am working with TLazSerial to collect data from weight indicators. I had to change the property  RcvLineCRLF: Boolean, for RcvLineTerminated: String, to use this component. There are devices that use another termination like LF, not CRLF, or EOT, or whatever. Obviusly i had to change this too:
Code: Pascal  [Select][+][-]
  1. function TLazSerial.ReadData: string;
  2. begin
  3.   result:='';
  4.   if FSynSer.Handle=INVALID_HANDLE_VALUE then
  5.     ComException('can not read from a closed port.');
  6.   if FRcvLineTerminated = EmptyStr then
  7.   result:=FSynSer.RecvPacket(0)
  8.   else
  9.   result:=FSynSer.RecvTerminated(0, FRcvLineTerminated);
  10. end;

esvignolo

  • Full Member
  • ***
  • Posts: 159
  • Using FPC in Windows, Linux, Macos
Re: TLazSerial : serial port component for Lazarus (windows and linux).
« Reply #234 on: October 17, 2017, 02:13:33 am »
Hello J.P., i make changes in your component for work in macos.

Do you want this changes?

hello,
Strange !   :-\  because cport.pas belongs to the comport library not lazserial.

Friendly, J.P
« Last Edit: October 18, 2017, 05:12:31 am by esvignolo »

bobihot

  • New Member
  • *
  • Posts: 35
Re: TLazSerial : serial port component for Lazarus (windows and linux).
« Reply #235 on: January 28, 2018, 07:21:50 pm »
I need to can manually set Baud rate. With USB-TTL converter I use successfully 2Mbs speed. New frequency are whole nums, not power of 9600. Like 11,920MHz system.

Thaddy

  • Hero Member
  • *****
  • Posts: 14165
  • Probably until I exterminate Putin.
Re: TLazSerial : serial port component for Lazarus (windows and linux).
« Reply #236 on: January 28, 2018, 09:25:13 pm »
I need to can manually set Baud rate. With USB-TTL converter I use successfully 2Mbs speed. New frequency are whole nums, not power of 9600. Like 11,920MHz system.
That's a power of 745, anyway it is non-standard for rs232 comm. Synapse comes with sources. If you need exotics : build exotics. IOW adapt the sources to your needs. Some people call that programming.
« Last Edit: January 28, 2018, 09:26:47 pm by Thaddy »
Specialize a type, not a var.

JJJ

  • New Member
  • *
  • Posts: 20
Re: TLazSerial : serial port component for Lazarus (windows and linux).
« Reply #237 on: May 29, 2018, 12:43:08 pm »
Hi,

I'm trying to read data from serial port without any success.
I then made simple script to send a test string to serial port.

It will send "123A" where "A" is delimitter
I use following code for parsing:

Code: Pascal  [Select][+][-]
  1. procedure TForm1.LazSerial1RxData(Sender: TObject);
  2. var Str : string;
  3. begin
  4.   Str :=  LazSerial1.ReadData;
  5.   CurPos := Pos('A' ,Str);
  6.   if CurPos = 0 then begin
  7.     FTempStr := FTempStr + Str;
  8.   end
  9.   else begin
  10.     FTempStr := FTempStr + Copy( Str, 1, CurPos-1);
  11.  
  12.     memo1.Lines.Add(FtempStr);
  13.     memo1.Lines.Add('X');
  14.  
  15.  
  16.     FTempStr := Copy(Str,CurPos +1, Length(Str) - CurPos);
  17.   end;        
  18.  

It should write "123" to memo and add "X" between every string.
Howerever, the result is:
Code: Pascal  [Select][+][-]
  1. 123A123A123A123
  2. X
  3. 123A123A123
  4. X
  5. 123A123A123A123
  6. X
  7. 123A123A123A123
  8. X
  9. 123A123A123A123
  10. X
  11. 123A123A123A123
  12. X
  13. 123A123A123A123
  14. X
  15. 123A123A123A123
  16. X
  17. 123A123A123
  18. X
  19. 123A123A123A123
  20. X
  21. 123A123A123A123
  22. X
  23.  

What I'm doing wrong?

tr_escape

  • Sr. Member
  • ****
  • Posts: 432
  • sector name toys | respect to spectre
    • Github:
Re: TLazSerial : serial port component for Lazarus (windows and linux).
« Reply #238 on: May 29, 2018, 02:22:23 pm »
I think your device sending all the time when you trying to parse what before received.

What kind device have you got?

The event can be overload and your data might be not ready or has missed parts.

In this case I would try to parse for only successful datas.


JJJ

  • New Member
  • *
  • Posts: 20
Re: TLazSerial : serial port component for Lazarus (windows and linux).
« Reply #239 on: May 29, 2018, 02:41:21 pm »
Thanks, you're right.
Actually I'm trying to read a sensor data from AVR. That example is just a test script and it works when I add a delay between packets.

It seems that I'm not able to use Lazserial because of the slowness.

 

TinyPortal © 2005-2018