"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

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

"ToString" function overwrites mapped variables !!

Post by PICFriend »

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 !!

Post by PICFriend »

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: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: "ToString" function overwrites mapped variables !!

Post by Benj »

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 !!

Post by PICFriend »

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: 797
Joined: Tue Feb 17, 2009 8:35 pm
Location: Haren GN, the Netherlands
Has thanked: 128 times
Been thanked: 264 times
Contact:

Re: "ToString" function overwrites mapped variables !!

Post by Jan Lichtenbelt »

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: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: "ToString" function overwrites mapped variables !!

Post by Benj »

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.01 KiB) Downloaded 387 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.

Post Reply