I wanted a string which is the sum of 4 other strings.
First I did it in one step like
STRING = str1+ str2+str3+str4 (1)
This works in simulation, but gave the wrong result in practice with the microchip.
Buiding the string step by step results in the correct string. Like
STRING= str1
STRING= STRING+str2
STRING= STRING+str3
STRING= STRING+str4 (2)
What is the reason of the wrong results of (1)?
Kind regards
Jan
Building string in one or more steps
Moderator: Benj
- Jan Lichtenbelt
- Posts: 797
- Joined: Tue Feb 17, 2009 8:35 pm
- Location: Haren GN, the Netherlands
- Has thanked: 128 times
- Been thanked: 264 times
- Contact:
-
- Valued Contributor
- Posts: 618
- Joined: Fri Jun 06, 2014 3:53 pm
- Has thanked: 184 times
- Been thanked: 195 times
- Contact:
Re: Building string in one or more steps
Hi Jan
This is a known "feature" of Flowcode and has been brought up a few times. The recommended way to concatenate is how you did it in your working example.
I'm sure a search of the forum will explain why, and sorry that I don't have time at present to supply a link to such.
Regards
This is a known "feature" of Flowcode and has been brought up a few times. The recommended way to concatenate is how you did it in your working example.
I'm sure a search of the forum will explain why, and sorry that I don't have time at present to supply a link to such.
Regards
-
- Valued Contributor
- Posts: 1188
- Joined: Wed May 31, 2017 11:57 am
- Has thanked: 70 times
- Been thanked: 439 times
- Contact:
Re: Building string in one or more steps
It 'compiles' to
- it looks like FC is attempting to use FCI_TEMP_STR for multiple purposes - so for example in line 2 - it is used in FCI_TOSTRING to get the string value of FCV_ALARM_TIME - but is already in use as the temporary result string.
Martin
Code: Select all
FCI_SHEAD(FCV_TEMPERATURE_STR,FCVsz_TEMPERATURE_STR, " ",2, FCI_TMP_STR,20);
FCI_SHEAD(FCI_TMP_STR,20, FCI_TOSTRING(FCV_ALARM_TIME, FCI_TMP_STR,20),20, FCI_TMP_STR,20);
FCI_SHEAD(FCI_TMP_STR,20, " M",3, FCV_TEMP_STR,20);
Martin
- Jan Lichtenbelt
- Posts: 797
- Joined: Tue Feb 17, 2009 8:35 pm
- Location: Haren GN, the Netherlands
- Has thanked: 128 times
- Been thanked: 264 times
- Contact:
Re: Building string in one or more steps
Hi Martin
The second line declares the error result I get, which shows the Alarm_Time to preceed all other strings.
Jan
The second line declares the error result I get, which shows the Alarm_Time to preceed all other strings.
Kind regards
FCI_SHEAD(FCI_TMP_STR,20, FCI_TOSTRING(FCV_ALARM_TIME, FCI_TMP_STR,20),20, FCI_TMP_STR,20);
Jan
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: Building string in one or more steps
Hello,
We've had this one on the list for a while now. It certainly does need fixing but there may be a cost in terms of bloating the RAM usage to allow us to buffer all the intermediary steps. I'll see if we can do anything to try and bump this one up so we can fix it.
We've had this one on the list for a while now. It certainly does need fixing but there may be a cost in terms of bloating the RAM usage to allow us to buffer all the intermediary steps. I'll see if we can do anything to try and bump this one up so we can fix it.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel