Problem receiving binary serial communications data

67 views
Skip to first unread message

Valentin Vasilev

unread,
Jun 23, 2017, 3:09:01 AM6/23/17
to DroidScript
Hello,
 Please explain the following situation. I work with byte packets via USB serial communication. Transmission works well with the function:
usb.Write(cmd_str,"ISO-8859-15");

 .By accepting the package, however, in the usb_OnReceive (data) function, each byte greater than 0x80 has been replaced
With three bytes 0xEF,0xBF,0xBD.
 What to do to get the raw data.
Thank you!

Dave Smart

unread,
Jun 23, 2017, 4:36:06 AM6/23/17
to DroidScript
DroidScript does not split any data up, it just sends it through byte by byte as it receives it when in binary mode.

If you are sending strings, then I assume your device is replying with strings (perhaps you could switch to text mode).

If you can't use text mode (perhaps because the device is sending you unicode or some other character set), then you will need to convert the bytes received back into a javascript string using the correct character set, or deal with the binary data.


Reply all
Reply to author
Forward
0 new messages