[Gambas-user] Issue/Problem with Serial Port Component

ron ronstk at ...239...
Mon Jun 5 01:33:08 CEST 2006


On Monday 05 June 2006 01:22, nando wrote:
> The remark line after the READ does some testing to see 
> if complete data received matches known formats.  There is no CR/LF
> embedded within the stream.  I am well practiced in ASCII/CL/LF stuff
> and binary over serial.
> 
> The _read events fires and the bunch of chars already received in the kernel
> are appended to the accumulating string.
> 
> The string is tested each _read event.
> 
> The problem here is that if you read *ALL* LOF(SPort) every _read event,
> there will not be a _read event for the last bunch.
> 
> Reading one less than LOF(SPort) ensures the _event one more time.
> 
> I have tried it here over 100 times with the same results.
> It's fascinating!
> 
> -Fernando
> 

Why don't you try

SUB SPort_Read()

  DIM s AS STRING
  DIM ls AS INTEGER
  dim ssum as string
  ssum=""
  DO UNTIL EOF(SPort)
    READ # SPort, s, 1
    ssum &= s
  Loop
  SPortReceiveString = SPortReceiveString & ssum
END

Ron




More information about the User mailing list