* * *

Author Topic: LazSerial  (Read 1581 times)

Stefano58

  • New member
  • *
  • Posts: 9
LazSerial
« on: December 13, 2016, 05:44:36 pm »
Hello everybody,
I have a problem with LazSerial,
- if in the form there is only one component, it  works
- if in the form there are two components and only one transmits, it works
- if there are two components in the form to transmit, the program crashes
I am using Win8.

Can anybody help me?
thanks in advance

Noodly

  • New member
  • *
  • Posts: 31
Re: LazSerial
« Reply #1 on: December 13, 2016, 07:56:29 pm »
Are both component instances trying to write to the same serial port?

In which case the second attempt will fail in the same way that two processes cannot simultaneously open a file for write access.


Jurassic Pork

  • Hero Member
  • *****
  • Posts: 640
Re: LazSerial
« Reply #2 on: December 13, 2016, 10:55:55 pm »
hello,
no crash, no problem in a project with two Tlazserial components using two different ports :
 - One port send GPS NMEA frames every one second and display received data.
- The second port send data every 300 ms and doesn't receive anything (no receive procedure).
Lazarus 1.6.0 32 bits Windows 7.
Friendly, J.P
« Last Edit: December 13, 2016, 11:00:24 pm by Jurassic Pork »

Stefano58

  • New member
  • *
  • Posts: 9
Re: LazSerial
« Reply #3 on: December 16, 2016, 05:15:44 pm »
Hello,
these are the conditions:

portA=COM52
portB=COM53

PortA.Open;
PortB.Open;
---------------
  • PortA send data to portB= OK
    PortA.WriteData('12345');
         200-300ms after
    if PortB.DataAvailable then RxB:=PortB.ReadData;
     
  • PortB send data to portA= OK
    PortB.WriteData('67890');
         200-300ms after
    if PortA.DataAvailable then RxA:=PortA.ReadData;
     
  • PortA send data to portB and PortB send data to portA= the program crashes
    PortA.WriteData('12345');
    PortB.WriteData('67890');  // at this point, the program crashes
         200-300ms after
    if PortA.DataAvailable then RxA:=PortA.ReadData;
    if PortB.DataAvailable then RxB:=PortB.ReadData


Friendly,
Stefano

Jurassic Pork

  • Hero Member
  • *****
  • Posts: 640
Re: LazSerial
« Reply #4 on: December 16, 2016, 10:11:40 pm »
hello,
are you in an app with GUI or in a console program ? Event driven or sequential program ?
Put you pascal file in attachment to see what is wrong.

Friendly J.P ?

Stefano58

  • New member
  • *
  • Posts: 9
Re: LazSerial
« Reply #5 on: December 19, 2016, 11:04:57 am »
Hello,

I'm in a app with GUI and I checked several options: see attachment.

b.r.
Stefano


Jurassic Pork

  • Hero Member
  • *****
  • Posts: 640
Re: LazSerial
« Reply #6 on: December 19, 2016, 11:51:18 pm »
hello,
no crash with your app on my system after 10 mn :  Lazarus 1.6.0 32 bits - Windows 7 64 bits.  PortA 9600 bds  - PortB 9600 bds 
The two serial ports connected with a crossover cable.

Friendly, J.P

« Last Edit: December 19, 2016, 11:57:49 pm by Jurassic Pork »

 

Recent

Get Lazarus at SourceForge.net. Fast, secure and Free Open Source software downloads Open Hub project report for Lazarus