I have used Gambas serial port for 12 years now without problems.

If there is nothing in the serial port queue, then that line might block.

I use this:

. . .
L=Lof(Sport)                     'how much is there now?
if L>1 then L=L-1                'leave at least one byte for next time around.
if L>0 then Read #Sport, Rx, L   'get all less one byte
Rx_all = Rx_all + Rx             'combine this piece into the whole receive 
string.
Rx=""                            'just in case it loops around, don't re-read 
Rx.
. . .


Most importantly, please do not think that just one READ will
retrieve a whole line or chunk of data from your serial port.
It will get only part of it because your computer reads bytes much faster
and empties the receiver buffer much faster than data send over RS232.

-Fernando

--
Open WebMail Project (http://openwebmail.org)


---------- Original Message -----------
From: alexchernoff <alexchern...@hotmail.com>
To: gambas-user@lists.sourceforge.net
Sent: Mon, 8 May 2017 22:45:11 -0700 (MST)
Subject: Re: [Gambas-user] Serial I/O with byte data

> Thanks Mike,
> 
> what I have is pretty much the same, it's this line that causes everything
> to stop.
> 
> *Read #Sport, Rx, Lof(Sport) *
> 
> A very similar program written in Xojo on the same system using same serial
> port works just fine. In Gambas, things just stop executing as soon as I do
> a Read on that port...
> 
> --
> View this message in context: 
> http://gambas.8142.n7.nabble.com/Serial-I-O-with-
> byte-data-tp58933p58939.html Sent from the gambas-user mailing list archive 
> at Nabble.com.
> 
> ------------------------------------------------------------------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> _______________________________________________
> Gambas-user mailing list
> Gambas-user@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user
------- End of Original Message -------


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user

Reply via email to