Recent

Author Topic: How to use Lazserial  (Read 26992 times)

microguy

  • Jr. Member
  • **
  • Posts: 60
Re: How to use Lazserial
« Reply #15 on: April 10, 2018, 05:36:35 am »
I am sure I am using right version 0.2. But I download different place. So I go ahead download where you gave me link. Looks like  Lazsynser is working now. It did run program but I couldn't type anything on it. I check to see if there is any error. It give me several errors. Read below... What am I doing wrong?

Compile package KControlsLaz 1.7: Exit code 1, Errors: 1, Warnings: 5, Hints: 4
kgraphics.pas(373,15) Warning: An inherited method is hidden by "Clear;"
kgraphics.pas(528,15) Note: Virtual method "Paint;" has a lower visibility (protected) than parent class THintWindow (public)
kgraphics.pas(542,15) Note: Virtual method "Paint;" has a lower visibility (protected) than parent class THintWindow (public)
kgraphics.pas(1079,36) Warning: Symbol "Handle" is deprecated
kgraphics.pas(3020,3) Note: Local variable "TextPtr" is assigned but never used
kgraphics.pas(3052,3) Note: Local variable "TextPtr" is assigned but never used
kmemo.pas(1525,78) Warning: Symbol "CM_SYSCOLORCHANGE" is not implemented
kmemo.pas(1696,14) Warning: An inherited method is hidden by "ScrollBy(LongInt;LongInt;Boolean):Boolean;"
khexeditor.pas(675,78) Warning: Symbol "CM_SYSCOLORCHANGE" is not implemented
kmemortf.pas(4030,10) Error: Identifier not found "UTF8Copy"

How can we fix it?

Reid


Jurassic Pork

  • Hero Member
  • *****
  • Posts: 1290
Re: How to use Lazserial
« Reply #16 on: April 10, 2018, 05:49:10 am »
hello,
Code: Pascal  [Select][+][-]
  1. kmemortf.pas(4030,10) Error: Identifier not found "UTF8Copy"
you have certainly the wrong version of Kcontrols.
Have you downloaded the version 1.7.1  ( see in one of my message above) and click on download repository.

Friendly, J.P
« Last Edit: April 10, 2018, 06:02:42 am by Jurassic Pork »
Jurassic computer : Sinclair ZX81 - Zilog Z80A à 3,25 MHz - RAM 1 Ko - ROM 8 Ko

microguy

  • Jr. Member
  • **
  • Posts: 60
Re: How to use Lazserial
« Reply #17 on: April 11, 2018, 05:36:16 am »
OK I removed KControls 1.7 and installed 1.7.1. Looks like there is no an error message but warning.

Messages, Warnings: 2
Warning: other unit files search path (aka unit path) of "KControlsLaz 1.7.1" contains "C:\lazarus\tkweb-kcontrols\tkweb-kcontrols-b75691b86426\source", which belongs to package "KControlsBase"
Warning: other unit files search path (aka unit path) of "KControlsBase 1.7.1" contains "C:\lazarus\tkweb-kcontrols\tkweb-kcontrols-b75691b86426\source", which belongs to package "KControlsLaz"

When I run the program and I change it to 1200, 8 , 1, n, hardware.  Then I click open button and put 01 in textbox then click send and the light did blink on USB Belkins adapter  RS232.  Seem it is working. When I want to closed the program I click on X where at upper the right corner to closed it. It won't let me. It went frozen. I had to go to task manager to kill the program. Anyway I tried it again and try to type anything or letter in HexEditor box on both left and right side. Nothing happen.

Reid   

mauricep

  • Newbie
  • Posts: 2
Re: How to use Lazserial
« Reply #18 on: May 18, 2018, 10:38:10 am »
@Jurassic Pork

Thank you!

crisares

  • Jr. Member
  • **
  • Posts: 63
Re: How to use Lazserial
« Reply #19 on: September 17, 2021, 08:45:03 pm »
hello,
here is in attachment a small project to send binary data from a comma delimited string with TLazserial component.
1 - click on the port settings button -> Choose your COM port and configure it.
2 - click on the open button to open the port
2 - Write a hexa comma delimited  string in the Tedit field and check the HEXA checkbox
example :  01,4E,35,48,65,6C,6C,6F,20,74,68,65,72,65 for <CTRL-A>N5Hello There
3 - click on the send button to write your data on the serial port.
The project use a TLazserial component and a TKHexEditor component (from KControls package that you can install from the online package manager). The TKHexEditor is used to display the data coming from the serial port.
the project has been tested on Windows 10 Lazarus 1.8.2  with two serial ports (COM3 and COM4) connected each other with a null modem cable. See attachment.
 
Friendly, J.P

I know this is an old post ... but Thank you very much Pork for the example project ... I am trying to learn how to handle the serial port from Lazarus and it will be useful to me.

Joek

  • New Member
  • *
  • Posts: 27
Re: How to use Lazserial
« Reply #20 on: November 15, 2023, 03:48:17 pm »
Just for fun...
Using Synser.WaitingDataEx together with LazSerial.ReadData will increase the CPU load from 1 to 30 percent... Does anyone know why this is happening? I have Win7 and I use a USB-COM converter. The sample application from the previous page (from Jurassic Pork) can be used for the test.
Code: Pascal  [Select][+][-]
  1.  procedure TFMain.SerialRxData(Sender: TObject);
  2. var Str : string;
  3. begin
  4.   if Serial.Synser.WaitingDataEx < 32 then exit;
  5.   Str :=  Serial.ReadData;
  6.   KHexEditor1.Append( KHexEditor1.LastVisibleIndex,Str);
  7.  
  8. end;  
  9.  

CM630

  • Hero Member
  • *****
  • Posts: 1553
  • Не съм сигурен, че те разбирам.
    • http://sourceforge.net/u/cm630/profile/
Re: How to use Lazserial
« Reply #21 on: May 27, 2025, 08:08:50 am »
I made this last week, it works for me, is somebody willing to try it and give feedback?
I have not tried it on a PC with a PC with an inbuilt COM port, only with USB and Bluetooth ones.
A snippet is attached.

Code: Pascal  [Select][+][-]
  1. function GetComFriendlyName (PortName : string) : String;
  2. var
  3.   Registry : TRegistry;
  4.   PortType: String = '';
  5.   VID_PID: String = '';
  6.   ID: string = '';
  7.   Contents : array of String;
  8.   KeyName: String = '';
  9. begin
  10.   Result := '';
  11.   Registry := TRegistry.Create(KEY_READ);
  12.   try
  13.     Registry.RootKey := HKEY_LOCAL_MACHINE;
  14.     if Registry.OpenKey('\SYSTEM\ControlSet001\Control\COM Name Arbiter\Devices',False) then
  15.     begin
  16.       Contents := Registry.ReadString(PortName).Split(['#']);
  17.       if (Length(Contents) > 2) then
  18.       begin
  19.         PortType := MidStr(Contents[0],5,MaxInt) ;
  20.         VID_PID := Contents[1];
  21.         ID := Contents[2];
  22.         KeyName := '\SYSTEM\ControlSet001\Enum\' + PortType + '\' + VID_PID + '\' + ID;
  23.         if Registry.OpenKey(KeyName,False) then
  24.           Result := Registry.ReadString('FriendlyName');
  25.       end; //Length
  26.     end; //if Registry.OpenKey
  27.   finally
  28.     Registry.Free;
  29.   end; //try
  30. end;
Лазар 4,4 32 bit (sometimes 64 bit); FPC3,2,2

eldonfsr

  • Hero Member
  • *****
  • Posts: 553
Re: How to use Lazserial
« Reply #22 on: May 29, 2025, 03:18:14 am »
Here a samples app

 

TinyPortal © 2005-2018