This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

A quention about RAM management

void LongLatPrintf(unsigned char row,unsigned char col, signed int du, unsigned int fen,float miao)
{

unsigned char T[2]={0},D[4]={0},P[6]={0},Q[3]={0};
unsigned int temp=0;
temp = abs(du);
sprintf(D,"%d",temp);//度
if (temp < 10)
{
D[3] = D[0];
D[2] = ' ';
D[1] = ' ';


}
else if (temp >= 10 && temp <100)
{
D[3] = D[1];
D[2] = D[0];
D[1] = ' ';
}
else if (temp >= 100 && temp <= 180)
{
D[3] = D[2];
D[2] = D[1];
D[1] = D[0];
}
if (du < 0) D[0] ='-';
else D[0] =' ';
D[4] = 0X00;
PrintFunc(3,row,col,D);//&#24230;
SignDegree(row,col+25);//&#24230;&#31526;&#21495;
sprintf(T,"%d",fen);
if (fen<10)
{
T[1]=T[0];
T[0]=' ';
T[2]=0X00;
}
PrintFunc(3,row,col+28,T);//&#20998;&#20540;
SignFen(row,col+41);
sprintf(P,"%f",miao);
// P[6] = 0X00;
if (miao<10)
{
T[0]=' ';
T[1]=P[0];
Q[0]=P[2];
Q[1]=P[3];
Q[2]=P[4];
Q[3]=0X00;
}
else
{
T[0] = P[0];
T[1] = P[1];
Q[0] = P[3];
Q[1] = P[4];
Q[2] = P[5];
Q[3] = 0X00;
}
PrintFunc(3,row,col+42,T);
SignFull(row,col+55);
PrintFunc(3,row,col+58,Q);


}


It is one subroutine of my program,which function is displaying LCD .In this subroutine ,the varivble T[2],D[4],ect,is just defined when the subroutine running .But in my project , these variable occupy the RAM alltimes like static variable.How can I get it free after the subroutine finished?

0