dspic Flowcode bug when adding string variables (SOLVED)

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 5.
To post in this forum you must have a registered copy of Flowcode 5 or higher.

Moderator: Benj

Post Reply
ronaldlijs
Posts: 139
Joined: Tue Jan 05, 2010 10:07 am
Has thanked: 20 times
Been thanked: 25 times

dspic Flowcode bug when adding string variables (SOLVED)

Post by ronaldlijs »

Hi guys,

Found a little bug that took me some time to figure out... although I have not found a solution for it yet...

OK, I have 5s string variables of 6 bytes each, TEXT1[6], TEXT2[6], TEXT3[6], TEXT4[6], TEXT5[6]. The characters in the vairables are "123456"
And I have 1x string variable 30 bytes long TEXTALL[30]

If I try this:

TEXTALL = TEXT1 + TEXT2 + TEXT3 + TEXT4 + TEXT5 + TEXT6

I should get the contents of the sum "123456123456123456123456123456123456".

Instead I get "12345612345612345612123456". Note the interruption of sequence at byte 20. This seems alike a bug to me: when adding text it seems the SUM is capped to 20 characters, this is weird!

Although the default length for a string variable in Flowcode is 20 characters... coincidence? I think not :-)

Anyway, if anyone knows how to fix this bug, it would be very much appreciated!

Cheers,
Ronald
Last edited by ronaldlijs on Thu May 23, 2013 12:04 am, edited 1 time in total.

ronaldlijs
Posts: 139
Joined: Tue Jan 05, 2010 10:07 am
Has thanked: 20 times
Been thanked: 25 times

Re: dspic Flowcode string bug when adding string variables

Post by ronaldlijs »

More info: In simulation mode it works fine, on hardware it doesn't.

ronaldlijs
Posts: 139
Joined: Tue Jan 05, 2010 10:07 am
Has thanked: 20 times
Been thanked: 25 times

Re: dspic Flowcode string bug when adding string variables

Post by ronaldlijs »

OK, found something interesting in the C code generated when compiling the program:

//Calculation
//Calculation:
// ADC_TEMP1_STRING = "123456"
// TEST = ADC_TEMP1_STRING + ADC_TEMP1_STRING + ADC_TEMP1_STRING + ADC_TEMP1_STRING + ADC_TEMP1_STRING
FCI_SCOPY("123456",6, FCV_ADC_TEMP1_STRING,FCSZ_ADC_TEMP1_STRING);
FCI_SHEAD(FCV_ADC_TEMP1_STRING,FCSZ_ADC_TEMP1_STRING, FCV_ADC_TEMP1_STRING,FCSZ_ADC_TEMP1_STRING, FCI_TMP_STR,20);
FCI_SHEAD(FCI_TMP_STR,20, FCV_ADC_TEMP1_STRING,FCSZ_ADC_TEMP1_STRING, FCI_TMP_STR,20);
FCI_SHEAD(FCI_TMP_STR,20, FCV_ADC_TEMP1_STRING,FCSZ_ADC_TEMP1_STRING, FCI_TMP_STR,20);
FCI_SHEAD(FCI_TMP_STR,20, FCV_ADC_TEMP1_STRING,FCSZ_ADC_TEMP1_STRING, FCV_TEST,FCSZ_TEST);


Although I don't understand this in full, I can see 20 everywhere, so there is something that limits the chain to 20 characters at some point?

Any light from anyone? Will try to look at the sources, but might take me ages if I don't know where to look...

Thanks!
R

ronaldlijs
Posts: 139
Joined: Tue Jan 05, 2010 10:07 am
Has thanked: 20 times
Been thanked: 25 times

Re: dspic Flowcode string bug when adding string variables

Post by ronaldlijs »

OK, seem to have found something around FCI_TMP_STR, but it's in the DLLs, nothing I can edit around Flowcode... :-(

Output below is strings against a Flowcode executable:
./v5/Flowcode5_PIC_16bit.exe
<!-- rule name="f():Left$" args="2" types="***" first="FCI_LEFTSTRING(%opn1, %[opn0FCI_TMP_STR%],%[len020%])"
<temp types="$" name="FCI_TMP_STR" len="20" />

Seems that TMP string variablesd are maximum 20 characters long?

ronaldlijs
Posts: 139
Joined: Tue Jan 05, 2010 10:07 am
Has thanked: 20 times
Been thanked: 25 times

Re: dspic Flowcode string bug when adding string variables

Post by ronaldlijs »

OK, issue fixed, a bit dodgy fix, but works fine!

I have edited with an Hex Editor the file Flowcode5_PIC_16bit.exe under C:\Program Files (x86)\Flowcode(dsPIC)\v5

I have found the 2x string FCI_TMP_STR ocurrences and changed it to len40 instead of len20. Saved the EXE and voilá it works now!!!!

Guys, would be nice to get this fixed, unless intended...

Regards,
R
PS: Can't wait to get Flowcode 6 when it's out!!!!!!
Attachments
Flowcode5_PIC_16bit.exe.jpg
Flowcode5_PIC_16bit.exe.jpg (32.25 KiB) Viewed 4368 times

kersing
Valued Contributor
Valued Contributor
Posts: 2045
Joined: Wed Aug 27, 2008 10:31 pm
Location: Netherlands
Has thanked: 553 times
Been thanked: 1081 times

Re: dspic Flowcode bug when adding string variables (SOLVED)

Post by kersing »

This issue has been noted before, see this thread. Hopefully fixed in FC6...
“Integrity is doing the right thing, even when no one is watching.”

― C.S. Lewis

ronaldlijs
Posts: 139
Joined: Tue Jan 05, 2010 10:07 am
Has thanked: 20 times
Been thanked: 25 times

Re: dspic Flowcode bug when adding string variables (SOLVED)

Post by ronaldlijs »

Thanks Jac, I have had not noticed the definition in the internals.c file, strange my script searching for it didn't find it :-)

Cheers!
R

Post Reply