Components under GPL are not ideal. Usually units/components are LGPL (and preferably with exception, like FPC and Lazarus themselves)Isn't it LGPL already? With different L, if I'm not mistaken...
GNU Library General Public License=LGPL, right?!?
=LGPL, right?!?the real LGPL has L stands for Lesser, not Library
Quote=LGPL, right?!?the real LGPL has L stands for Lesser, not Library
I am Jurassic, so i use formely licenses :DGood motivation - ROFL ;)
I have Lazarus 0.9.28.2. I have it on 2 machines. This one is a WinXP machine. I also have a Raspberry Pi with raspbian. I was hoping to get it working on the PC first and then install on the RasPi.You don't have to stick with 0.9.28.2 because of Raspbian. Take a look at this: http://forum.lazarus.freepascal.org/index.php/topic,20803.msg121127.html#msg121127
I have installed Lazarus 1.0.6 on the PC and LazSerial installs fine and the test app works. However, nowhere can I find out clearly how to install 1.0.6 on the Raspberry Pi with Raspbian. apt-get install lazarus gives me the same 0.9.28.2 version, so I seem stuck!
I have installed Lazarus 1.0.6 on the PC and LazSerial installs fine and the test app works. However, nowhere can I find out clearly how to install 1.0.6 on the Raspberry Pi with Raspbian. apt-get install lazarus gives me the same 0.9.28.2 version, so I seem stuck!The link I gave says this:
...you might try to install FPC from repository, and then install Laz 1.0.6 from source (I think that was the last version that could be compiled with FPC 2.6.0)This means that FPC is installed through apt-get (as you already did), and Lazarus from source as in wiki described here:
If you are using a raspi, forget TLazSerial as it won't install. Nor will 5dpo!!Try Synaser from synapse.ararat.cz, or just use FPC serial unit instead (search for serial.pp file since that's all docs you will get for it).
socat -d -d PTY: PTY:
if it is good you can see in your terminal window something like this :2013/08/20 03:41:03 socat[4275] N PTY is /dev/pts/5
2013/08/20 03:41:03 socat[4275] N PTY is /dev/pts/6
2013/08/20 03:41:03 socat[4275] N starting data transfer loop with FDs [3,3] and [5,5]
$GPRMC,035654,A,4851.184,N,00220.977,E,000.5,054.7,200813,020.3,E*71
I tried to compile lazserial on mac and send this error
/Developer/lazarus/componentes/LazSerial/synaser.pas(1959,54) Error: Incompatible types: got "ShortInt" expected "Pointer"
/Developer/lazarus/componentes/LazSerial/synaser.pas(2345,41) Warning: range check error while evaluating constants
/Developer/lazarus/componentes/LazSerial/synaser.pas(2348,36) Hint: Mixing signed expressions and longwords gives a 64bit result
/Developer/lazarus/componentes/LazSerial/synaser.pas(2358,38) Error: Identifier not found "TIOCGSERIAL"
/Developer/lazarus/componentes/LazSerial/synaser.pas(2387) Fatal: There were 2 errors compiling module, stopping
some body compiled that on mac.
best regards.
fernando
{$IFDEF DARWIN}
const // From fcntl.h
O_SYNC = $0080; { synchronous writes }
+ { FIOSSIOSPEED is from /System/Library/Frameworks/IOKit.framework/Versions/A/Headers/serial/ioss.h
+ Its definition will be in $FPC/rtl/darwin/termios.inc soon with any luck. For details see:
+ http://lists.freepascal.org/lists/fpc-pascal/2011-August/030025.html }
+ FIOSSIOSPEED = (IOC_IN or (sizeof(culong) and IOCPARM_MASK) << 16) or ((ord('T') << 8) or 2); { 18399.13 }
{$ENDIF}
.....
+ {$IFDEF DARWIN}
+ { Use FIOSSIOSPEED to assign the baud rate directly. This overides the
+ baud rate assigned via the cfsetXspeed functions above but they must
+ still be called to assign valid control flag values in the termios }
+ SerialCheck(fpIoctl(integer(FHandle), FIOSSIOSPEED, @dcb.BaudRate));
+ ExceptCheck;
+ {$ELSE}
....
//SerialCheck(fpioctl(FHandle, TCIOflush, TCIOFLUSH));
SerialCheck(fpioctl(FHandle, TCIOflush,Pointer(PtrInt(TCIOFLUSH))));
const
TIOCGSERIAL = $541E; //// defined in oldlinux.ppp line 1034
uses
//// {$IFDEF LINUX}
{$IFDEF UNIX} //// !
Classes,
{$IFDEF UseCThreads}
cthreads,
{$ENDIF}
{$ELSE}
Windows, Classes, //registry,
{$ENDIF}
B500000 it seems like a constant value in hex so it must have a dollar in front ($). If it doesn't then something is wrong with the unit.
LazSerial's installation may fail with this errorObviously you put a lot of effort to achieve this. Thanks for sharing.
/usr/lib/lazarus/1.0.10/components/LazSerial/synaser.pas(252,22) Error: Identifier not found "B500000"
If you don't need highest baudrates you can remove them: comment/remove these lines
,(500000, B500000),
..
(4000000, B4000000)
and change this
MaxRates = 30; //UNIX
to this
MaxRates = 19; //UNIX
If you need them, I don't know...
Const
..
{$ifdef cpupowerpc}
..
{$endif cpupowerpc}
{$ifdef cpui386}
..
{$endif cpui386}
{$ifdef cpusparc}
..
{$endif cpusparc}
{$ifdef cpux86_64}
..
{$endif cpux86_64}
{$ifdef cpuarm}
..
// missing B constants should go in here
{$endif cpuarm}
{$if defined(cpumips) or defined(cpumipsel)}
..
{$endif CPUMIPS}
{$ifdef CPUM68K}
..
{$endif CPUM68K}
If I edit termios.inc the IDE can see the constant, but the compiler stills complainsThe compiler does not know about these changes, yet.
Those constants aren't defined in the ARM section of termios.inc, maybe they're just not supported on ARM (and sparc)Hardware wise they are supported. Software wise, it might need some changes, and since you replaced the constants with their values and TLazSerial did not complain about it that means it does not support these speeds as well. If you do not need these speeds then you might as well delete the constants as you had done.
If someone finds a working method, please let me know!
Paul,
Thanks!
I see the version of synazer.pas in CtrlTerm is 007.005.005 (2013), so I should have used this instead of 007.005.002 (2011) supplied by Jurasssic. I will see if I can get the CtrlTerm project to compile. Maybe that is a better starting point.
It does not compile as is, but I can see if the patch works for Darwin. If anyone has a patch file for 007.005.005 that would be very helpful. :)
All I need to do is read a stream of bytes from a COM port, which is connected from a counter with a RS-232 to USB converter.
Any suggestions are greatly appreciated.
Cheers,
Frederick
{$IFNDEF FPC}
FHandle := THandle(Libc.open(pchar(FDevice), O_RDWR or O_SYNC));
{$ELSE}
FHandle := THandle(fpOpen(FDevice, O_RDWR or O_SYNC or O_NONBLOCK)); //// FWV
{$ENDIF}
Paul,
Thanks!
I see the version of synazer.pas in CtrlTerm is 007.005.005 (2013), so I should have used this instead of 007.005.002 (2011) supplied by Jurasssic. I will see if I can get the CtrlTerm project to compile. Maybe that is a better starting point.
It does not compile as is, but I can see if the patch works for Darwin. If anyone has a patch file for 007.005.005 that would be very helpful. :)
All I need to do is read a stream of bytes from a COM port, which is connected from a counter with a RS-232 to USB converter.
Any suggestions are greatly appreciated.
Cheers,
Frederick
Just an update on my progress. I had no luck compiling CtrlTerm on OS X, and was having some trouble installing LazSerial. I run Lazarus on Windows, OS X, and Linux, and I'm not very familiar with using packages. So I just used synaser 007.005.005 and made this fix:Code: [Select]{$IFNDEF FPC}
FHandle := THandle(Libc.open(pchar(FDevice), O_RDWR or O_SYNC));
{$ELSE}
FHandle := THandle(fpOpen(FDevice, O_RDWR or O_SYNC or O_NONBLOCK)); //// FWV
{$ENDIF}
I made a wrapper class to open and close the port, and read incoming data. I call it from a timer and have it working on Windows and OS X. Nothing fancy, but it does what I need.
Thanks for the input!
Cheers,
Frederick
type
TBaudRate=(br___110,br___300, br___600, br__1200, br__2400, br__4800,
br__9600,br_14400, br_19200, br_38400,br_56000, br_57600,
br115200,br128000, br230400,br256000, br460800, br921600);
const
BaudInt: array[TBaudRate] of integer=(110,
300, 600, 1200, 2400, 4800, 9600,14400, 19200, 38400,56000, 57600,
115200,128000,230400,256000, 460800, 921600);
BaudString: array[TBaudRate] of string=('110',
'300', '600', '1200', '2400', '4800', '9600','14400','19200','38400','56000',
'57600','115200','128000','230400','256000', '460800', '921600');
ShowMessage(BaudString[Serial1.BaudRate]);
//BSD 3-Clause License, СМ630, 2014
function StringToASCIIStrHexColumned (aString: String): string;
const
CrLf=#13#10;
var
i:integer;
begin
Result:=' │ 00 01 02 03 04 05 06 07 │ 08 09 0A 0B 0C 0D 0E 0F'
+CrLf+ '────────┼─────────────────────────┼────────────────────────';
for i:= 0 to Length(aString)-1 do
if ((i mod 16) = 0)
then Result:= Result +CrLf + IntToHex(trunc(i/16),8) + '│ ' + IntToHex( (i),2)+' '
else if ((i mod = 0) then Result:= Result + '│ ' + IntToHex ((i),2)+' '
else Result:= Result + IntToHex ((i),2)+' ';
end;
Example: Memo.Clear; Memo.Append(StringToASCIIStrHexColumned ('abcdefghijklmnoprstuvwxyz')); oruses ... , synaser;
type TSerial = class(TBlockSerial)
end;
var ser: TSerial;
begin
ser:=TSerial.Create;
...
...
end.
IMHO, bes solution is to contact the developers of Ararat Synapse,FYI: If that bug is confirmed: submitting a patch via the synapse mailing list has been a painless process for me both for bug fixes and commenting improvements...
my O.S is Windows 7 64 bits, i use Lazarus 1.2.4 32 bits. I have created two virtual serial ports paired with the software com0com .
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim readValue As String
readValue = My.Computer.Registry.GetValue("HKEY_LOCAL_MACHINE\HARDWARE\DEVICEMAP\SERIALCOMM", "\Device\BthModem10", Nothing)
MsgBox("The value is " & readValue)
End Sub
It returned the entire string. So I have nothing else to think, except that there is a bug in the FPC registry implementation, or precisely registry.pp (https://github.com/macek/fpc/blob/master/packages/fcl-registry/src/registry.pp).function TRegistry.ReadString(const Name: string): string;In the source of registry.pp I could not find where StringSizeIncludesNull gets its value from, but it always returns true!?!
Var
Info : TRegDataInfo;
begin
GetDataInfo(Name,Info);
if info.datasize>0 then
begin
If Not (Info.RegData in [rdString,rdExpandString]) then
Raise ERegistryException.CreateFmt(SInvalidRegType, [Name]);
SetLength(Result,Info.DataSize);
If StringSizeIncludesNull then
SetLength(Result, Info.DataSize-1)
else
SetLength(Result, Info.DataSize);
GetData(Name,PChar(Result),Info.DataSize,Info.RegData);
end
else
result:='';
end;
function TRegistry.ReadString(const Name: string): string;
Var
Info : TRegDataInfo;
begin
GetDataInfo(Name,Info);
if info.datasize>0 then
begin
If Not (Info.RegData in [rdString,rdExpandString]) then
Raise ERegistryException.CreateFmt(SInvalidRegType, [Name]);
SetLength(Result,Info.DataSize);
GetData(Name,PChar(Result),Info.DataSize,Info.RegData);
FStringSizeIncludesNull:=(RightStr(Result,1)=#0);
If StringSizeIncludesNull then
SetLength(Result, Info.DataSize-1)
else
SetLength(Result, Info.DataSize);
end
else
Result:='';
end;
Edit: Reported as bug 27002 (http://mantis.freepascal.org/view.php?id=27002).can implement datapackets?By not cross posting and creating a new thread with your question.
how send and receive Records?
procedure TfrmMain.Lazser1RxData(Sender: TObject);
var
s : string;
begin
//
try
s := Lazser1.ReadData;
if s <> '' then
begin
wait_comm := False;
if com_some = '' then
begin
LogAdd(mem_Log1, 'RCV<: ' + s);
LogAdd(mem_Log2, 'RCV<: ' + StrToHex(s));
end
else
begin
LogAddStr(mem_Log1, s);
LogAddStr(mem_Log2, StrToHex(s));
end;
com_some := com_some + s;
end;
except
// LogAdd(mem_General,'Exp : ' );
end;
end;
I want to send SMS with this AT COMMAND:You send #13#10, the command expects:
LazSerial1.WriteData('at+cmgs="PHONENUMBER"'+#13#10); LazSerial1.WriteData('Some text to send via sms'); LazSerial1.WriteData(#26);
But there is a line break at the beginning of the text that I received.
AT+CMGS=<number><CR><message><CTRL-Z>You add the #10 intentionally.
I want to send SMS with this AT COMMAND:You send #13#10, the command expects:
LazSerial1.WriteData('at+cmgs="PHONENUMBER"'+#13#10); LazSerial1.WriteData('Some text to send via sms'); LazSerial1.WriteData(#26);
But there is a line break at the beginning of the text that I received.QuoteAT+CMGS=<number><CR><message><CTRL-Z>You add the #10 intentionally.
When the dialog setup appears, do you see your portThere is no dialogue, there is a window with an error.
exception 'Lazserialsetup.pas' line 211
ComComboBox1.Text: = ComPort.Device
How to install the component ( lazarus version >= 1.x) :
1 - Download the file LazSerial.7z (you must be logged in the forum to see and download the file).
2 - Open the file and uncompress it in the Lazarus/components directory.
3 - Open Lazarus IDE , Open the package ( packages/open a package file) LazSerialPort.lpk
4 - Compile
5 - Install
;) i have found your errorOh thank you.
varit will be OK.
Serial: TLazSerial;
Cast it to PAnsiChar first. Then the meta-data for length and refcount will be stripped.
Strange thing is that the Arduino receives 2 extra characters before the actual string.
hello,
yes xinyiman TLazserial only works on a Gui App :( . But you can use synaser for your purpose.
Friendly, J.P
How?
How?
There is a simple synaser console example here: http://turbocontrol.com/simpleserial.htm (http://turbocontrol.com/simpleserial.htm)
There is an easy synapse console example here to send emails (and texts): http://turbocontrol.com/easyemail.htm (http://turbocontrol.com/easyemail.htm)
I hope to update the second example in the next week as I'm using a newer version of it to send the current temperature in both emails and texts with a Raspberry Pi.
{:Returns the number of received bytes waiting for reading. 0 is returned
when there is no data waiting.}
function WaitingData: integer; virtual;
{:Returns @True, if you can from read any data from the port. Status is
tested for a period of time given by the Timeout parameter (in milliseconds).
If the value of the Timeout parameter is 0, the status is tested only once
and the function returns immediately. If the value of the Timeout parameter
is set to -1, the function returns only after it detects data on the port
(this may cause the process to hang).}
function CanRead(Timeout: integer): boolean; virtual;
{:This event is triggered when the communication status changes. It can be
used to monitor communication status.}
property OnStatus: THookSerialStatus read FOnStatus write FOnStatus;
function TLazSerial.ReadData: string;
begin
result:='';
if FSynSer.Handle=INVALID_HANDLE_VALUE then
ComException('can not read from a closed port.');
if FRcvLineCRLF then
result:=FSynSer.RecvString(0)
else
result:=FSynSer.RecvPacket(0);
end;
{:Read all available data and return it in the function result string. This
function may be combined with @link(RecvString), @link(RecvByte) or related
methods.}
function RecvPacket(Timeout: Integer): AnsiString; virtual;
This method serves for line protocol implementation and uses its own
buffers to maximize performance. Therefore do NOT use this method with the
@link(RecvBuffer) method to receive data as it may cause data loss.}
function Recvstring(timeout: integer): AnsiString; virtual;
If >= 10
TLazSerial v0.1
Serial Port Component for Lazarus (windows and linux).
by Jurassic Pork 03/2013
This library is Free software; you can rediStribute it and/or modify it
under the terms of the GNU Library General Public License as published by
the Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
This program is diStributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; withOut even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License
for more details.
You should have received a Copy of the GNU Library General Public License
along with This library; if not, Write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. }
Based on :
- SdpoSerial v0.1.4
CopyRight (C) 2006-2010 Paulo Costa
paco@fe.up.pt
- Synaser library by Lukas Gebauer
- TcomPort component
Features :
Changed : baudrate values.
stop bits new value : 1.5
new event : onstatus
new property FRcvLineCRLF : if this property is true, you use RecvString
in place of RecvPacket when you read data from the port.
new procedure ShowSetupDialog to open a port settings form :
the device combobox contain the enumerated ports.
new procedure to enumerate real serial port on linux ( in synaser).
Demo : a simulator of serial port gps + serial port receiver :
you can send NMEA frames ( GGA GLL RMC) to the opened serial port
(start gps simulator). You can change speed and heading.
In the memo you can see what is received from the opened serial port.
In the status bar you can see the status events.
tested with windows 7 and Ubuntu 12.04
if you haven't serial ports in your PC you can use virtual ports :
1 - WINDOWS
To simulate a paired serial ports on windows : com0com
2 - Linux
To simulate a paired serial ports on linux : socat
ex : socat -d -d PTY: PTY:
To connect to a bluetooth GPS on Linux
echo connection to a bluetooth GPS(/dev/rfcomm0)
sudo rfcomm bind 0 xx:xx:xx:xx:xx:xx 1
====================================================================
How to install the component ( lazarus version >= 1.x) :
1 - Download the file LazSerial.7z (you must be logged in the forum to see and download the file).
2 - Open the file and uncompress it in the Lazarus/components directory.
3 - Open Lazarus IDE , Open the package ( packages/open a package file) LazSerialPort.lpk
4 - Compile
5 - Install
====================================================================
Sorry for my poor english but it isn't my natural language.
to be continued if it is usable ....
J.P
hello,
tr_escape , have you always your problem ?
Has anyone tried the raspberry Lazarus communication with Arduino?Any problems? I can test it, if you want. RS232 communications over USB works,
Reading and writing.
Things have been been improved, significant!
Removed the small USB-hub's and placed a PCI-to-4xRS232 ( about 15 USD )in my pc.
From time to time, running in Lazarus-Debug-mode, the stuff hangs for few seconds and continieus again, but again: much less than before.
The send/received data is ok, no wrong characters or drop-outs!
Gonna debug-Run again but ow with no other programm's open like internet and my mikropascal-IDE for Arduino.
To be continued.
4B 4C 4D 4E 4F 50 51 52 53 54 55 56
57 58 59 5A 00
V 0.2 01/2017 : BaudRates for UNIX fixed - synaser files units renamed (with laz prefix)
scan port for linux improved
-running RPi 3RPi 3 behaves different then RPi 1 and 2. If you have older Pi available then test if it works. Read this: http://www.briandorey.com/post/Raspberry-Pi-3-UART-Overlay-Workaround. If you search the net for "Raspberry Pi 3B UART BT problems" you will see that there are a lot of problems, especially that UART speed is tied to clock which can change dynamically. Try to have some low fixed speed and turn off all power savings. Old Pi had UART0 as serial interface, but in Pi3 UART0 is used for Bluetooth so without a workaround UART1 on GPIO14 & 15 should be used. The reason why this was changed is that UART0 was influenced by the core_freq and that's important for BT. However nothing stops you to try some other Linux flavor like Arch or TinyCore, or bare metal like Ultibo, and see if something is different or fixed. See also http://raspberrypi.stackexchange.com/questions/45570/how-do-i-make-serial-work-on-the-raspberry-pi3 and http://raspberrypi.stackexchange.com/questions/45143/how-to-disable-dma-when-using-uart-on-the-raspberry-pi-2.
- enabled com port
- swapped and returned back the two serial ports (for some reason LazSerial only wants to talk to ttyAMA0)
- disabled console
- disabled Bluetooth to allow communication to be directed to IO port pins
- changed uart clock: "init_uart_clock=64000000"
- hooked a trusty modern 140Mpoints scope to the TX pinAre you measuring directly on Pi header pin or later from some RS232 voltage levels? Do you send a single char or thousands in your tests (FIFO is just 8 bytes)?
Tested all the above with minicom: "minicom -b 4000000 -o -D /dev/ttyAMA0"Can you try to send some big file with nothing else but thousands of 'U' characters directly to port with redirection from command line without using minicom and report if you still find that it works as good as in minicom. Then try to send the same file from minicom and report if it behaves exactly the same. Btw, are your tests from Pi booted to console, or you are running some desktop and window manager? Can you retest your Lazarus application just from console, before any desktop is booted?
I must say it works beautifully!
I modified LazSerial component to include baud rates 1000000, 2000000, 3000000 and 4000000.Can you take a look into minicom sources to see how it does the port setup? Can you show the simplest code you use for testing? How do you initialize port from LazSerial? Maybe your modifications are not enough. You can try some other serial library like Platform eXtended Library (PXL), or directly latest trunk version of Synapse SynaSer. You can also try to setup port from command line before use in your application. If that works then you can call script or external sh process from your application.
The result is quite poor: I get 500Kbps when setting 1Mbit (please check the table of results below). If I initialise the port through minicom @4Mbps and only send data through my application then I get the 4Mbps out of the TX pin (for some reason both minicom and my application can share the serial port without conflicts).
hello,
there is a new version of TLazSerial :QuoteV 0.2 01/2017 : BaudRates for UNIX fixed - synaser files units renamed (with laz prefix)
scan port for linux improved
TLazserial is now in Github here (https://github.com/JurassicPork/TLazSerial)
the 0.2 version is the master version (in progress)
Be careful ! someone (zbyna) has created another version of TLazserial in github with the version 0.1 of TLazserial . It is not the official version !!!!
Friendly, J.P
JP,
Can you share your definitions for thermios.inc?
Hello,JP,
Can you share your definitions for thermios.inc?
Why ? I haven't changed the file termios.inc
The file termios.inc for linux is in the folder Lazarus/fpc/3.0.0/source/rtl/linux
Friendly, J.P
Read all available data and return it in the function result string.
(00112233445566778899abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ)Global variable :
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
hello,
Strange ! :-\ because cport.pas belongs to the comport library not lazserial.
Friendly, J.P
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.
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.That's not correct. The standard is a protocol, not a speed limitation< grumpy, very grumpy >:D >:D >
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.
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
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:
Hint: (11030) Start of reading config file /home/arm1/fpc2/fpc/bin/x86_64-linux/fpc.cfg
Hint: (11031) End of reading config file /home/arm1/fpc2/fpc/bin/x86_64-linux/fpc.cfg
Free Pascal Compiler version 3.2.0-beta-r20:39835 [2018/10/08] for arm
Copyright (c) 1993-2018 by Florian Klaempfl and others
(1002) Target OS: Linux for ARMHF
(3104) Compiling LazSerialPort.pas
(3104) Compiling lazserial.pas
(3104) Compiling lazsynaser.pas
/home/arm1/fpc2/config_lazarus/onlinepackagemanager/packages/LazSerial/lazsynaser.pas(255,15) Error: (5000) Identifier not found "B1000000"
/home/arm1/fpc2/config_lazarus/onlinepackagemanager/packages/LazSerial/lazsynaser.pas(255,23) Error: (3203) Illegal expression
/home/arm1/fpc2/config_lazarus/onlinepackagemanager/packages/LazSerial/lazsynaser.pas(256,15) Error: (5000) Identifier not found "B1152000"
/home/arm1/fpc2/config_lazarus/onlinepackagemanager/packages/LazSerial/lazsynaser.pas(256,23) Error: (3203) Illegal expression
/home/arm1/fpc2/config_lazarus/onlinepackagemanager/packages/LazSerial/lazsynaser.pas(257,15) Error: (5000) Identifier not found "B1500000"
/home/arm1/fpc2/config_lazarus/onlinepackagemanager/packages/LazSerial/lazsynaser.pas(257,23) Error: (3203) Illegal expression
/home/arm1/fpc2/config_lazarus/onlinepackagemanager/packages/LazSerial/lazsynaser.pas(258,15) Error: (5000) Identifier not found "B2000000"
/home/arm1/fpc2/config_lazarus/onlinepackagemanager/packages/LazSerial/lazsynaser.pas(258,23) Error: (3203) Illegal expression
/home/arm1/fpc2/config_lazarus/onlinepackagemanager/packages/LazSerial/lazsynaser.pas(259,15) Error: (5000) Identifier not found "B2500000"
/home/arm1/fpc2/config_lazarus/onlinepackagemanager/packages/LazSerial/lazsynaser.pas(259,23) Error: (3203) Illegal expression
/home/arm1/fpc2/config_lazarus/onlinepackagemanager/packages/LazSerial/lazsynaser.pas(260,15) Error: (5000) Identifier not found "B3000000"
/home/arm1/fpc2/config_lazarus/onlinepackagemanager/packages/LazSerial/lazsynaser.pas(260,23) Error: (3203) Illegal expression
/home/arm1/fpc2/config_lazarus/onlinepackagemanager/packages/LazSerial/lazsynaser.pas(261,15) Error: (5000) Identifier not found "B3500000"
/home/arm1/fpc2/config_lazarus/onlinepackagemanager/packages/LazSerial/lazsynaser.pas(261,23) Error: (3203) Illegal expression
/home/arm1/fpc2/config_lazarus/onlinepackagemanager/packages/LazSerial/lazsynaser.pas(262,15) Error: (5000) Identifier not found "B4000000"
/home/arm1/fpc2/config_lazarus/onlinepackagemanager/packages/LazSerial/lazsynaser.pas(262,23) Error: (3203) Illegal expression
/home/arm1/fpc2/config_lazarus/onlinepackagemanager/packages/LazSerial/lazsynaser.pas(765,1) Fatal: (10026) There were 16 errors compiling module, stopping
Fatal: (1018) Compilation aborted
Error: /home/arm1/fpc2/fpc/bin/x86_64-linux/ppcrossarm returned an error exitcode
We have a large program that compiles perfectly with Lazarus 1.8.4 "stable" and FPC3.2.0 "fixes". Perfectly, that is, IF you select as Target OS=Linux and Target CPU=Intel (x64). If you select Target CPU=ARM, you get errors in the serial component :you can try to put the code of engkin (see here (https://forum.lazarus.freepascal.org/index.php/topic,20481.msg141726.html?PHPSESSID=2mro6nahaegf3ikvg726fumvc5#msg141726)) :
{c_cflag bits}
CBAUD = $000100F;
B0 = $0000000;
B50 = $0000001;
B75 = $0000002;
B110 = $0000003;
B134 = $0000004;
B150 = $0000005;
B200 = $0000006;
B300 = $0000007;
B600 = $0000008;
B1200 = $0000009;
B1800 = $000000A;
B2400 = $000000B;
B4800 = $000000C;
B9600 = $000000D;
B19200 = $000000E;
B38400 = $000000F;
EXTA = B19200;
EXTB = B38400;
CSIZE = $0000030;
CS5 = $0000000;
CS6 = $0000010;
CS7 = $0000020;
CS8 = $0000030;
CSTOPB = $0000040;
CREAD = $0000080;
PARENB = $0000100;
PARODD = $0000200;
HUPCL = $0000400;
CLOCAL = $0000800;
CBAUDEX = $0001000;
B57600 = $0001001;
B115200 = $0001002;
B230400 = $0001003;
B460800 = $0001004;
B500000 = $0001005;
B576000 = $0001006;
B921600 = $0001007;
B1000000 = $0001008; // this line was added!
B1152000 = $0001009; // this line was added!
B1500000 = $000100A; // this line was added!
B2000000 = $000100B; // this line was added!
B2500000 = $000100C; // this line was added!
B3000000 = $000100D; // this line was added!
B3500000 = $000100E; // this line was added!
B4000000 = $000100F; // this line was added!
CIBAUD = $100F0000;
CMSPAR = $40000000;
CRTSCTS = $80000000;
const
{$IFDEF UNIX}
{$IFDEF DARWIN}
MaxRates = 18; //MAC
{$ELSE}
MaxRates = 30; //UNIX
{$ENDIF}
{$ELSE}
MaxRates = 19; //WIN
{$ENDIF}
Rates: array[0..MaxRates, 0..1] of cardinal =
(
(0, B0),
(50, B50),
(75, B75),
(110, B110),
(134, B134),
(150, B150),
(200, B200),
(300, B300),
(600, B600),
(1200, B1200),
(1800, B1800),
(2400, B2400),
(4800, B4800),
(9600, B9600),
(19200, B19200),
(38400, B38400),
(57600, B57600),
(115200, B115200),
(230400, B230400)
{$IFNDEF DARWIN}
,(460800, B460800)
{$IFDEF UNIX}
,(500000, B500000),
(576000, B576000),
(921600, B921600),
(1000000, $0001008),
(1152000, $0001009),
(1500000, $000100A),
(2000000, $000100B),
(2500000, $000100C),
(3000000, $000100D),
(3500000, $000100E),
(4000000, $000100F)
{$ENDIF}
{$ENDIF}
);
{$ENDIF}
{$IFDEF DARWIN}
const // From fcntl.h
O_SYNC = $0080; { synchronous writes }
{$ENDIF}
i do not have a fix for you but it would be useful to know what your target baud rate is.Hey,
procedure Flush; virtual;Have you tried to remove the flush operation ?
Waits until all data to is sent and buffers are emptied. Warning: On Windows systems is this method returns when all buffers are flushed to the serial port controller, before the last byte is sent!
It worked when I have only one Lazserial component in the job. So it looks like three are too many!Do those three components connect to the same machine through the same PC port? Can you go back to a single LazSerial component? How do you connect at all if 28800 is not supported?
@PaulRowntreeMy LabVIEw code was compiled, and we don't have access to the compiler any more. It sent the mass spec data back to a Delphi program via DDE, and I really wanted to get away from that system to allow future interfaces.
Maybe you need to extend the TLazSerial code with your specific baud rate.
If TLazSerial don't support it at all, you could use VISA. You have already used LabVIEW, so you have the Driver already installed.
If you have already written your program with TLazSerial, i think it would be faster to modify TLazSerial than rewrite to use VISA instead.
@PaulRowntreeMy LabVIEw code was compiled, and we don't have access to the compiler any more. It sent the mass spec data back to a Delphi program via DDE, and I really wanted to get away from that system to allow future interfaces.
Maybe you need to extend the TLazSerial code with your specific baud rate.
If TLazSerial don't support it at all, you could use VISA. You have already used LabVIEW, so you have the Driver already installed.
If you have already written your program with TLazSerial, i think it would be faster to modify TLazSerial than rewrite to use VISA instead.
It doesn't look like I can extend TLasSerial in an OOP way, it would take recoding a few lines in the unit, and perhaps Synaser as well. I would like to avoid private forks. The really odd part is that the Win10 device manager doesn't even list 28800 as an option ...Thanks!
hello,Thanks JP, I really appreciate this. Will try tonight!pr
i have modified 3 files of the TLazSerial package to add the 28800 baud rate choice on Windows.
1 - Replace the 3 files by the files in the attachment file.
2 - Recompile the package
I don't know if it is OK but you can try.
Friendly, J.P
I didn't appreciate that ... thanks for the info! JP modified his LazSerial codes, so I will try that route first.Cheers!pr@PaulRowntreeMy LabVIEw code was compiled, and we don't have access to the compiler any more. It sent the mass spec data back to a Delphi program via DDE, and I really wanted to get away from that system to allow future interfaces.
Maybe you need to extend the TLazSerial code with your specific baud rate.
If TLazSerial don't support it at all, you could use VISA. You have already used LabVIEW, so you have the Driver already installed.
If you have already written your program with TLazSerial, i think it would be faster to modify TLazSerial than rewrite to use VISA instead.
It doesn't look like I can extend TLasSerial in an OOP way, it would take recoding a few lines in the unit, and perhaps Synaser as well. I would like to avoid private forks. The really odd part is that the Win10 device manager doesn't even list 28800 as an option ...Thanks!
Well, LabVIEW and VISA are two different things. If you have LabVIEW once installed and used VISA with it, you could use VISA64.dll / VISA.dll direct over Lazarus.
For newer Versions you need to update over National Instruments, because the VISA version from NI is most likely the reference implementation on Windows, but you don't need LabVIEW to use it.
It is an industry standard from the IVI Foundation and NI is only a vendor for it.
I use it for my daily work and wrote a few Programs for measuring and control with it.
Even on Linux over NI-VISA (openSUSE).
hello,Works like a charm JP, thank you!pr
i have modified 3 files of the TLazSerial package to add the 28800 baud rate choice on Windows.
1 - Replace the 3 files by the files in the attachment file.
2 - Recompile the package
I don't know if it is OK but you can try.
Friendly, J.P
Why do these delays occur? How to fix that they were not?Your application does everything in the main thread, including message processing. When that main thread is blocked with something as slow as serial communication, windows messages do not get processed and your application is not responding looking frozen until communication is finished. Sometimes when chunks of communication are not that long you can fix this by putting Application.ProcessMessages in comm loops or by putting it right after one serial communication and before next one is started. More often you need to do it the proper way, by introducing separate communication thread and synchronizing that with your application and GUI. To do that you need a lot of learning. Search the docs, forum and wiki on the topic.
In the inspector of the objects of the library Lazserial there is a parameter Device. SynSer. DeadlocktimeOut, which is not updated in the inspector of objects, it must be registered in the program itself. The default value is 30000, you need to set it to the value you need, I set 100 for myself.Synapse SynaSer is the father of TLazSerial and for DeadlockTimeout property documentation at http://synapse.ararat.cz/doc/help/synaser.TBlockSerial.html#DeadlockTimeout says:
This timeout value is used as deadlock protection when trying to send data to (or receive data from) a device that stopped communicating during data transmission (e.g. by physically disconnecting the device). The timeout value is in milliseconds. The default value is 30,000 (30 seconds).It smells like you have communication issues on a physical wire level or with device it self. Your application might behave better, but source of the problem still exists. If you use RS485 then check for proper resistor termination on both ends of the cable. If you use RS232/422/485 then check for proper shielding. If you use RS232 then max cable length for 9600bps in ideal conditions should not exceed 30m, in less ideal conditions even less. With 115200 do not go over 10m if you want stable communication. You can use oscilloscope to see how clean your signal is. Avoid energetic cables whenever you can with your communication cable, especially if heavy consumers and motors are powered by them. Keep distance of at least 30cm from them, and if you must cross them then cross at 90 degree angle (even when having a proper distance). Check grounding on both sides. Find shortest possible communication cable and let your laptop be the only master to your device, disconnecting other devices if there are any. If problems go away, wiring is guilty. If they persist then device is guilty. If device allows then lowering communication speed can help sometimes.
There are no devices.Stops are still there. They just now last 100ms instead of 30s so it is harder to notice them. There are many virtual comm port implementations, and some are buggy. You should try another one.
Made virtual connected com ports.
And after I changed the value of 30,000 to 100, everything began to work fine. No data loss was noticed, the program was already running for more than an hour and there were no stops.
wp, you can put this update in your online package manager.Please contact GetMem. I don't have access to the OPM repo.
you can put this update in your online package manager.is for GetMem
you can put this update in your online package manager.Done. Thank you!
Probably stupid question, but:No.
Can LazSerial be used with Delphi 2007 in some way?
In the project all components are created in code, there is no "drop on form" automatic handling of them, so I know exactly where they are actually handled.
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.
{$IFDEF FPC} interfaces, //Needed for LazSerial to work in a Console program LazSerial, //The serial component {$ELSE} //Delphi
When I now build the project the linker does not trigger any
complaints about missing Menu related identifiers and the build
succeeds!
{$IFDEF FPC} interfaces, //Needed for LazSerial to work in a Console program LazSerial, //The serial component {$ELSE} //Delphi
When I now build the project the linker does not trigger any
complaints about missing Menu related identifiers and the build
succeeds!
The Interfaces unit links in the GUI widgetset of the LCL which is not really what you want for a command line application. Do as Jurassic Pork (and Michael on the mailing list) suggested and use the serial component of Synaser directly (TLazSerial is "simply" a GUI wrapper for that).
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
I would appreciate help understanding how to install the TLazSerial components under newly installed Lazarus 2.0.0 running on Raspbian Pi OS. I have successfully downloaded the TLazSerial files. I have edited LazSynaser.pas to comment out the UNIX specific baud rates and changed the value of MaxRates from 30 to 19 to avoid compile errors. When I attempt to Install the package I get the message "The package 'LazSerialPort-0.2.pas' was marked for installation. Currently Lazarus only supports static linked packages. The real installation needs rebuilding and restartng of Lazarus.". Attempts to rebuildLazarus are met with a dialog showing ""Cannot find fpdebug used by Lazarus".Use the Pacakage manager, no need to update.
Apologies if this is an issue with Lazarus rather than LazSerial but I'd be very grateful for any guidance members can offer to a Linux / Lazarus newbie.
I would appreciate help understanding how to install the TLazSerial components under newly installed Lazarus 2.0.0 running on Raspbian Pi OS.How come you are installing such an old version of Lazarus?
I have successfully downloaded the TLazSerial files.How did you "download the files"?
Thanks Bo for highlighting the menu items "Package / Online Package Manager.I have created a blogpost on my server (https://blog.boberglund.com/) where I describe how to install Fpc/Lazarus on Raspberry Pi using sources from Subversion.
That part worked up to the point where the recompile failed with "Cannot find fpdebug used by Lazarus".
I sense that is a different problem and unrelated to to TLazSerial.
The old versions of fpc and Lazarus are the versions installed by Raspbian OS using Preferences | Add / Remove programs or sudo apt-get install fpc and sudo apt-get install lazarus.
Seems I need to work out how to install the current versions of fpc and lazarus before attempting to install LazSerial again.
That will be a new learning opportunity for me.
Many thanks for you help and understanding.
Behavior of the SerTest sample application included with TLazSerial:
My configuration: Windows7, Lazarus v 2.0.10, LazSerialPort 0.3., Profilic USB-COM1 - HW connection of pins 2 and 3.
- Connection COM1 OK, Start simulator OK - reading and writing data OK, processor load approx. 0-3%
- Stop simulator - OK, CPU load approx. 0%
- COM closing, application termination - CPU load 25% (!!!), COM can no longer be opened, application cannot be terminated
- application cannot be terminated, SerialRXData thread apparently blocks COM and prevents execution of Application.Terminate
Some ideas?
i have tried to connect an USB-COM with prolific chip : i can't connect to it too old ! (see attachment)
with FTDI USB-COM i have no problem.
i have tried to connect an USB-COM with prolific chip : i can't connect to it too old ! (see attachment)Even the non-counterfeit version of the Prolifics, fucntioning well, are treated as 'too old' by the latest drivers.
with FTDI USB-COM i have no problem.
I have one counterfeit FTDI IC in a Mega2560. The Windows driver by FTDI bricks it, unbricked it in Linux and now works fine in Linux. I regularly read people still getting a counterfeit FTDI in a cheap USB serial.i have tried to connect an USB-COM with prolific chip : i can't connect to it too old ! (see attachment)
with FTDI USB-COM i have no problem.
Are you aware that Prolific has always had a massive problem with counterfeits? A substantial proportion of Prolific-badged chips in cheap serial converters are actually generic microcontrollers programmed to emulate the basic Prolific functionality... if you want something reliable than buy something with an FTDI chip in it from a reputable source.
MarkMLl
I have one counterfeit FTDI IC in a Mega2560. The Windows driver by FTDI bricks it, unbricked it in Linux and now works fine in Linux. I regularly read people still getting a counterfeit FTDI in a cheap USB serial.
thanks hansotten for the driver, now i can connect to my prolific USB-COM, transferring some data between this USB-COM and a FTDI USB-COM , close the port but i have the same problem than Joek -> i can't close the sertest application (by the cross) i need to kill it. This problem does'nt come with FTDI USB-COM.i have tried to connect an USB-COM with prolific chip : i can't connect to it too old ! (see attachment)Even the non-counterfeit version of the Prolifics, fucntioning well, are treated as 'too old' by the latest drivers.
with FTDI USB-COM i have no problem.
Get an old version of the driver: http://retro.hansotten.nl/other-retro-articles/serial-usb-adapters-testing/ search for Prolific, and get the archive from there.
[ 12.235225] usbserial: USB Serial support registered for pl2303and for the driver under windows 10 :
[ 12.235249] pl2303 1-5:1.0: pl2303 converter detected
[ 12.236333] usb 1-5: pl2303 converter now attached to ttyUSB0
NOTE:
Windows 8/8.1/10 are NOT supported in PL-2303HXA and PL-2303X EOL chip versions.
Run PL2303 CheckChipVersion tool program in Windows XP/Vista/7 to check chip version.
Windows Vista, XP, 2000, 98 and Windows ME driver technical support are discontinued.
Prolific recommends to use PL-2303HXD (HX Rev D) or PL2303TA chip.
i must check if this code always works and why there is a "lost" closesocket at the beginning of the code.i confirm that there is a wrong code in the deviceClose procedure of lazserial.pas since the version 0.2 :-[
abcdefghijklmnoprstuvwxyz0123456789Friendly, J.P
I've been looking in my notes but can find my fix quickly.
The issue is not with pascal, it with the OS. The OS removes LF chars from the comm port streams, even binary. what you need to do is to tell the OS to not filter the stream. you can probably find the commands faster than I on the web...
I have a pb with SerialRxData;your examples are not very clear -> can you show all the hexa bytes which are sent ( ex 00 FF AA 13 10 ...) and what is received in SerialRxData and the code in the SerialRxData.
to illustrate:
msg1 raw:
dst 0 6C02 ldt 88.50 5120
msg1:
dem dst?:dst 0 6C02 <-crc 1rst msg dst
ldt 88.50 5120>7E81<NOKcrc
crc ldt| |here add after receive and recalcul crc...
dst is a distance measure.
ldt is lidar temperature.
as you can see lazserial miss a #10 char separator
it's happen when I do video flux with sdpovideo.
msg2:
dem gps?:gps 0 0 0 0 0 0 0 0 0902
ypr 288.8 -12.3 -5.7 6EC8>1999<NOKcrc
msg gps is follow by ypr mesg. Lose #10 separator. So the two message are not separated...
As I said
with no video treatment this is perfecly working.
with video (charge cpu and threads) it's happens some mistake
message wich are separated before sending with a chr(10) are not correctly parse/treated...
so this is not the OS.
thank's for your reply.on windows i can see the first webcam with this command :
How did you do to read: /dev/video0 ?
I have one counterfeit FTDI IC in a Mega2560. The Windows driver by FTDI bricks it, unbricked it in Linux and now works fine in Linux. I regularly read people still getting a counterfeit FTDI in a cheap USB serial.
Which is why I used the words "reputable source": this has been a problem with Prolifics for a /long/ time... quite a few years before FTDI had their patience tested beyond endurance.
The Linux FTDI utility allows you to do things like writing a serial number to the chip: does that work properly, or it there some other easy way of detecting an FTDI counterfeit?
In LazSerial I don't think so, maybe JurassicPork knows more.I don't think : LazSerial use synaser and i haven't seen these properties in the TBlockSerial class of Synaser.
I am trying to connect a multimeter (GDM-461) to the PC.
...
I have also tried TLazSerial, but the DMM sends no data with the following source:
I am trying to connect a multimeter (GDM-461) to the PC.You do not have all comm settings as the DMM likes it, like DTR setting, lazSerial.SetDTR etc
I have also tried TLazSerial, but the DMM sends no data with the following source:
LazSerial1.Device:= 'COM1'; LazSerial1.BaudRate:=br_19200; LazSerial1.FlowControl:= fcXonXoff; LazSerial1.DataBits:=db7bits; LazSerial1.Parity:=pOdd; LazSerial1.Open;
You do not have all comm settings as the DMM likes it, like DTR setting, lazSerial.SetDTR etc
I usually use the standard serial unit for that sort of thing, with a background thread if necessary.https://github.com/MarkMLl/Mastech_ms2115b (https://github.com/MarkMLl/Mastech_ms2115b)Thanks, I do not know what the “standart serial unit” is, I will check your code.
Thanks, I do not know what the “standart serial unit” is, I will check your code.[/size][/font]
I have also tried TLazSerial, but the DMM sends no data with the following source:why LazSerial1.FlowControl:= fcXonXoff; ?
[/size]
LazSerial1.Device:= 'COM1'; LazSerial1.BaudRate:=br_19200; LazSerial1.FlowControl:= fcXonXoff; LazSerial1.DataBits:=db7bits; LazSerial1.Parity:=pOdd; LazSerial1.Open;
It is the serial unit which is supplied, as standard, with FPC.Sigrok looks interesting, the protocol is not hard to interprete, anyway.
...The protocol of your meter appears to be well understood, https://sigrok.org/wiki/GW_Instek_GDM-397 (https://sigrok.org/wiki/GW_Instek_GDM-397) which is a close relation, I'd expect there to be plenty of projects on Github etc. that interface with it so the use case for FPC/Lazarus is if you have specific output format requirements or want to "pretty it up".
MarkMLl
I'm doing this on Lazarus 2.2.0 on macOS Catalina - as I noticed that, as of version 0.6, TLazSerial supports macOS. I've opened the package file, then clicked on Use -> Install. I get prompted to re-compile Lazarus, which I do, and it stops with the errorHave a look :o here : Compiling aborts with error message "Cannot find IDEOptionsIntf used by IDEWindowIntf (https://gitlab.com/freepascal.org/lazarus/lazarus/-/issues/39535)
idewindowintf.pas(26,3) Fatal: Cannot find IDEOptionsIntf used by IDEWindowIntf, incompatible ppu=/Applications/Lazarus/components/buildintf/units/x86_64-darwin/ideoptionsintf.ppu, multiple packages: BuildIntf, IDEIntf
I don't know about macOS, but at Linux there is no much sense to place lock file in directory where system doesn't look for lock files, except if only your program accesses this port. It is simpler to set TBlockSerial.LinuxLock property to false, though at Linux usually there is no problem with /var/lock.in the constructor of TLazserial the LinuxLock property is set to false :
in the constructor of TLazserial the LinuxLock property is set to false :Yes, but
I actually found I could use the LazSynaSer unit directly. However, this has a major bug in it which causes the application to hang in macOS.In lazsynaser LinuxLock is set to true, as in original synaser.
It also does it if you use TLazSerial (as this is just a wrapper). It is caused by the creation of the lock file.
And then I don't understand thisOK, confused myself now - now not sure why the test program for TLazSerial hangs my machine. By setting the LinuxLock to false, it shouldn't try to create a lockfile, under any OS. I need to play some more.It also does it if you use TLazSerial (as this is just a wrapper). It is caused by the creation of the lock file.
new in v0.6 version (03/2022)set the NonBlock property to true in the SynSer part of TLazserial component (see attachment)
Fixes for OS-X (thanks to rphoover), SynSer(synaser) properties now persistent, v0.3 of GPS simulator
On OS-X you must set the property SynSer/NonBlock to True in the properties of TLazserial component.
I'm trying to read data from serial port. In every package has '#' as a first mark and '&' as an end mark but after the end mark there is also 16-bit CRC. With Lazserial it is easy to use "RecvTerminated" but how to get CRC in same package?Can you show us three data frames (as you received them).
I'm trying to read data from serial port. In every package has '#' as a first mark and '&' as an end mark but after the end mark there is also 16-bit CRC. With Lazserial it is easy to use "RecvTerminated" but how to get CRC in same package?
Hello,I'm trying to read data from serial port. In every package has '#' as a first mark and '&' as an end mark but after the end mark there is also 16-bit CRC. With Lazserial it is easy to use "RecvTerminated" but how to get CRC in same package?Can you show us three data frames (as you received them).
And have you CRLF between data frames ?
Friendly, J.P
Here is few examples:
#MASTER;WNER;OBC;169;TD;1;4;0;17.8;92;0;&84B6
#MASTER;TBAR;67.5;TD;7;9;N;22.0;15.8;1;&D407
#TBAR,MASTER,55,RECPT;&088B
...just to clarify...
There is no CRLF between frames.
Here is few examples:
#MASTER;WNER;OBC;169;TD;1;4;0;17.8;92;0;&84B6
#MASTER;TBAR;67.5;TD;7;9;N;22.0;15.8;1;&D407
#TBAR,MASTER,55,RECPT;&088B
This makes it not depend on the masses of stuff that Synapse brings along and is easily portable to Windows and what have you....
...just to clarify...
There is no CRLF between frames.
Here is few examples:
#MASTER;WNER;OBC;169;TD;1;4;0;17.8;92;0;&84B6
#MASTER;TBAR;67.5;TD;7;9;N;22.0;15.8;1;&D407
#TBAR,MASTER,55,RECPT;&088B
you have shown each frame on a separate line. so it was all one line and you when in front of each "#" and press enter?
if not, then there was either a CR or LF char that your capture software as "decoded" for you to show 3 lines
Sorry, my bad. Of course it is like #MASTER;WNER;OBC;169;TD;1;4;0;17.8;92;0;&84B6#MASTER;TBAR;67.5;TD;7;9;N;22.0;15.8;1;&D407#TBAR,MASTER,55,RECPT;&088B etc.You can try this:
Hello,Thank you J.P! Works well.Sorry, my bad. Of course it is like #MASTER;WNER;OBC;169;TD;1;4;0;17.8;92;0;&84B6#MASTER;TBAR;67.5;TD;7;9;N;22.0;15.8;1;&D407#TBAR,MASTER,55,RECPT;&088B etc.You can try this:
I have only used Lazserial in simple single port windows apps. however it is based off the older synaser which I have used hard and a lot. With it, I've had up to 3 ports running under one program without any comm issues. besides making it OS independent, has Lazserial changed the low level interface in windows in the last few years since I last grabbed a copy?No change in the low-level interface in windows. I don't know if you have seen that i have edited my previous message to say that i have solved my problem on windows (error in s baud speed settings for the second tLazSerial component). In attachment a screen capture of my two ports sertest project working on windows.
PS, I do use each TBlockSerial in separate threads /port
Drop 2 LazSerial on the form and create the OnRXData Event. Only in this Event read the Data and add it to the meno. Do not read it in a timer, use the Event and store the read data, then read it in the timer if you need it there.I use RxData events in my project.
No change in the low-level interface in windows. I don't know if you have seen that i have edited my previous message to say that i have solved my problem on windows (error in s baud speed settings for the second tLazSerial component). In attachment a screen capture of my two ports sertest project working on windows.no, our post must have bounced over to the dark side of the planet and passed as two ships in the night...
Friendly, J.P