[Gambas-user] Serial I/O with byte data
T Lee Davidson
t.lee.davidson at ...626...
Wed May 10 17:47:18 CEST 2017
On 05/08/2017 12:13 PM, alexchernoff wrote:
> Dear all,
>
> I am receiving data over a serial port which is sent by a byte[].write
> function (an array of bytes)
>
> I get the SerialPort1_read() event raised where I try to read data, RxBuffer
> is a string var
>
> *Try Read #SerialPort1, RxBuffer, Lof(SerialPort1)*
>
> as soon as I do, the whole program stops, some other timers in other modules
> also stop to fire. In fact when running the program in Gambas again, it does
> not execute even the startup, so have to restart the IDE.
>
> what am I doing wrong?
>
> thanks!
If you are attempting to read the data _into_ RxBuffer, it appears your syntax is incorrect.
According to http://gambaswiki.org/wiki/lang/read , the syntax for the READ statement is:
Variable = READ [ # Stream , ] Length
Perhaps try:
Try RxBuffer = Read #SerialPort1, Lof(SerialPort1)
---
Lee
More information about the User
mailing list