Page 1 of 1
dspic Flowcode bug when adding string variables (SOLVED)
Posted: Wed May 22, 2013 11:24 pm
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
Re: dspic Flowcode string bug when adding string variables
Posted: Wed May 22, 2013 11:33 pm
by ronaldlijs
More info: In simulation mode it works fine, on hardware it doesn't.
Re: dspic Flowcode string bug when adding string variables
Posted: Wed May 22, 2013 11:43 pm
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
Re: dspic Flowcode string bug when adding string variables
Posted: Wed May 22, 2013 11:50 pm
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?
Re: dspic Flowcode string bug when adding string variables
Posted: Wed May 22, 2013 11:58 pm
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!!!!!!
Re: dspic Flowcode bug when adding string variables (SOLVED)
Posted: Thu May 23, 2013 12:21 am
by kersing
This issue has been noted before, see
this thread. Hopefully fixed in FC6...
Re: dspic Flowcode bug when adding string variables (SOLVED)
Posted: Thu May 23, 2013 7:34 am
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