"ToString" function overwrites mapped variables !!

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 4.
To post in this forum you must have a registered copy of Flowcode 4 or higher. To sign up for this forum topic please use the "Online Resources" link in the Flowcode Help Menu.

Moderator: Benj

PICFriend
Posts: 36
Joined: Sat Nov 13, 2010 6:50 pm
Location: Germany
Contact:

"ToString" function overwrites mapped variables !!

Postby PICFriend » Sat Nov 20, 2010 11:12 pm

Hello,

In my programm i got mapped variables like A=0x20 and B=0x21. At these positions is normaly 0 because it is cleared by porgrammstart. Everything works fine, till i use the ToString$(RTC_sec_1) - function.
In the assemblercode in found MOVWF FSR.
At wich position is the function in use? It seems so, like it is in my mapped area from0x20 till 0x29 in the PIC 16F876.
A LCD printout from the mapped register before stringfunction gives 0.
A LCD printout from the mapped register after stringfunction gives 138. => there is my variable overwritten!!

Who helps me????????????????? :?:

PICFriend
Posts: 36
Joined: Sat Nov 13, 2010 6:50 pm
Location: Germany
Contact:

Re: "ToString" function overwrites mapped variables !!

Postby PICFriend » Sat Nov 20, 2010 11:37 pm

Me again!

Same error occours with LCDPrintString macros.
In the string - routines might be somthing confused.

---later more

regards

Carsten

User avatar
Benj
Matrix Staff
Posts: 14566
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4596 times
Been thanked: 4239 times
Contact:

Re: "ToString" function overwrites mapped variables !!

Postby Benj » Tue Nov 23, 2010 10:07 am

Hello,

Are you defining the mapped variables in the supplementary code window or are you defining them from a C code icon in the main flowchart window?

PICFriend
Posts: 36
Joined: Sat Nov 13, 2010 6:50 pm
Location: Germany
Contact:

Re: "ToString" function overwrites mapped variables !!

Postby PICFriend » Tue Nov 23, 2010 8:41 pm

Hey,

It seems to be a solution. When i define mapped variables in the supplementary code window via "static char ..." everything is ok. In the C-Code Icon via volatile char or only char there are Problems!

Thanks for this help!


:lol:

User avatar
Jan Lichtenbelt
Posts: 794
Joined: Tue Feb 17, 2009 8:35 pm
Location: Haren GN, the Netherlands
Has thanked: 128 times
Been thanked: 261 times
Contact:

Re: "ToString" function overwrites mapped variables !!

Postby Jan Lichtenbelt » Tue Sep 25, 2012 2:14 pm

I do not understand what is said above.

But I have the feeling that I have also a problem with tostring$ function.

I use it in a macro with Number a byte Num a string(6): .num= tostring$(.number). .number is an input variable, which I find to be zero afterwards.

Can someone help?

Jan Lichtenbelt

User avatar
Benj
Matrix Staff
Posts: 14566
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4596 times
Been thanked: 4239 times
Contact:

Re: "ToString" function overwrites mapped variables !!

Postby Benj » Tue Sep 25, 2012 4:57 pm

Hello,

v5 users please copy the attached file into your "Flowcode\v5\CAL\PIC\" folder and the problem should now be fixed.

PIC_CAL_String.c
(19.75 KiB) Downloaded 187 times


It looks like we were overwriting the actual variable rather then taking a copy and then working with that.

If anyone is having this problem in v4 then please let me know.
These users thanked the author Benj for the post (total 2):
Enamul (Tue Sep 25, 2012 5:53 pm) • petesmart (Wed Sep 26, 2012 4:45 am)
Rating: 10.53%