Page 1 of 1

"ToString" function overwrites mapped variables !!

Posted: Sat Nov 20, 2010 11:12 pm
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????????????????? :?:

Re: "ToString" function overwrites mapped variables !!

Posted: Sat Nov 20, 2010 11:37 pm
by PICFriend
Me again!

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

---later more

regards

Carsten

Re: "ToString" function overwrites mapped variables !!

Posted: Tue Nov 23, 2010 10:07 am
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?

Re: "ToString" function overwrites mapped variables !!

Posted: Tue Nov 23, 2010 8:41 pm
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:

Re: "ToString" function overwrites mapped variables !!

Posted: Tue Sep 25, 2012 2:14 pm
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

Re: "ToString" function overwrites mapped variables !!

Posted: Tue Sep 25, 2012 4:57 pm
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 391 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.