ECIO USB serial, string limited to 20 chars?

For E-blocks user to discuss using E-blocks and programming for them.

Moderators: Benj, Mods

Post Reply
wardnica
Posts: 13
Joined: Wed Jun 08, 2011 1:46 pm
Has thanked: 1 time
Contact:

ECIO USB serial, string limited to 20 chars?

Post by wardnica »

I'm trying to send a string with multiple variables to the computer using the usb serial. I make a string_out out of 4 variables, of which two are gps location, and are 8 characters long. Then I try to send 2 other strings existing out of 4 digit numbers...
Somehow the string seems limited to 20 characters, but when I make string_out = "abcdefgh" + "ABCDEFGH" + "1234" + "1234" ; the string is totally received in the computer...
so, when I compose the string out of multiple variables, the last numbers of the string are cut of, and when I just make 'one' string as above, the string is received completely...
(yes, the string_out is long enough ofcourse :) )

User avatar
JonnyW
Posts: 1230
Joined: Fri Oct 29, 2010 9:13 am
Location: Matrix Multimedia Ltd
Has thanked: 63 times
Been thanked: 290 times
Contact:

Re: ECIO USB serial, string limited to 20 chars?

Post by JonnyW »

Hi. Can you post a (simple) flowchart example and we can have a look?

Cheers,

Jonny

wardnica
Posts: 13
Joined: Wed Jun 08, 2011 1:46 pm
Has thanked: 1 time
Contact:

Re: ECIO USB serial, string limited to 20 chars?

Post by wardnica »

I'm sorry for the late responce :(
A snapshot of the part of the program where te problem is situated: https://www.dropbox.com/s/ar00cmiz350y2 ... %20usb.png
The string manipulation marked red is the problem, the computer receives only 20 characters of the string which is 24 characters long, the last 4 characters just disappear...

User avatar
JonnyW
Posts: 1230
Joined: Fri Oct 29, 2010 9:13 am
Location: Matrix Multimedia Ltd
Has thanked: 63 times
Been thanked: 290 times
Contact:

Re: ECIO USB serial, string limited to 20 chars?

Post by JonnyW »

Hello.

There is a hard limit on a multiple concatenation - Flowcode uses a temporary string of 20 characters to perform this if more than one string is appended.

Try the code:

Code: Select all

.string_out = .substring1 + " " + .substring2 + " " + .substring3 + " "
.string_out =  .string_out + .substring4
.string_out = .string_out + "/"
And see if this works OK.

There are ways to extend this 20-char limit, but they are untested and involve editing the back-end C code, so I would advise this way first.

Cheers,

Jonny

wardnica
Posts: 13
Joined: Wed Jun 08, 2011 1:46 pm
Has thanked: 1 time
Contact:

Re: ECIO USB serial, string limited to 20 chars?

Post by wardnica »

Unfortunately the code you suggested didn't work... I guess I'll have to change the Ccode...
It's solved :D I changed every "20" number of the Ccode of the existing calculation block to 35 and now it works :)
Thank you

User avatar
JonnyW
Posts: 1230
Joined: Fri Oct 29, 2010 9:13 am
Location: Matrix Multimedia Ltd
Has thanked: 63 times
Been thanked: 290 times
Contact:

Re: ECIO USB serial, string limited to 20 chars?

Post by JonnyW »

Hi. Glad that sorted it, but you may have issues there that will cause strange behaviour...

In the internals.c file in the FCD directory of Flowcode there is a variable called FCI_TMP_STRING[20]. Change this 20 to something higher and your data will not overflow the array.

Cheers,

Jonny

Post Reply