我声明变量
u8 buf[1003];
u8 Data[513];
u8 bufx[52];
int i=0,j=0;
u8 povit=0;
u8 splitstr[51];
int split=0,splitindex=0;
编译的时候没问题,可是在运行的时候程序却出现了卡死现象,能保证各个变量的内存空间是够的,之后把变量改成了
u8 buf[1003];
u8 Data[513];
int i=0,j=0;
u8 povit=0;
u8 splitstr[51];
int split=0,splitindex=0;
u8 bufx[52];程序就能正常运行了,没有任何问题了,现在搞不清楚状况啊,求高手赐教啊,紧急救命啊
此帖出自
小平头技术问答
{
FileInfoStruct FileInfo;
FAT_TABLE FAT_TAB;
u8 buf[1003];
u8 Data[513];
// u8 bufx[52];
int i=0,j=0;
u8 povit=0;
u8 splitstr[51];
int split=0,splitindex=0;
u8 bufx[52];
LCD_Clear_Down(BLACK);
BACK_COLOR=BLACK;
POINT_COLOR=BLUE;
Show_Str(20,140,"′Ë2ù×÷½«»áÇå¿Õμô֮ǰËùóDμÄ2é¼ˉêy¾Y£¬êÇ·ñ¼ìDø",16,0);
Show_Str(20,180,"F1£o¼ìDø F2£o·μ»Ø",16,0);
while(1)
{
povit=KEY_Scan();
if(povit==10)break;
else if(povit==11) return;
}
LCD_Clear_Down(BLACK);
if(File_Get("ìõÂë","TXT",&FileInfo,&FAT_TAB)!=0)
{
BACK_COLOR=BLACK;
POINT_COLOR=BLUE;
Show_Str(20,170,"»ñè¡ìõÂë꧰ü",16,0);
return;
}
BACK_COLOR=BLACK;
POINT_COLOR=BLUE;
Show_Str(20,170," ",16,0);
Show_Str(20,130,"ÕyÔúμ¼èëìõÂë...",16,1);
Show_Str(20,160,"μ¼èëìõêy:",16,1);
BACK_COLOR=BLACK;
POINT_COLOR=BLUE;
LCD_ShowNum(20+16*5,160,0,6,16);
memset(buf,0x20,sizeof(buf));
j=0;
i=0;
while(i<FileInfo.F_Size) //»ñè¡Õû¸öÎļtμÄ3¤¶è
{
memset(Data,0,sizeof(Data));
if(i+512<=FileInfo.F_Size)
povit=File_LocatRead(&FileInfo,&FAT_TAB,Data,i,512); //ÿ′ζáè¡512¸ö×Ö½ú
else
povit=File_LocatRead(&FileInfo,&FAT_TAB,Data,i,FileInfo.F_Size-i);
if(povit==0)
{
split=0;
while(1)
{
memset(splitstr,0,sizeof(splitstr));
splitindex=split;
split=strsplitstr(Data,splitstr," ",split,50);
memset(bufx,0x20,sizeof(bufx));
memcpy(&bufx[0],"1^RT|",5);
memcpy(&bufx[5],splitstr,my_strlen(splitstr));
if(split==-1)
{
if(i+512<=FileInfo.F_Size)
i=i+512-(512-splitindex);
else
goto SOS;
break;
}
if(strlen((StrTrim((char *)bufx)))!=0)
{
memcpy(&buf[j%20*50],bufx,my_strlen(bufx));
j++;
}
if(j%20==0)
{
//D′èëflash
memcpy(&buf[1000],"AA",2);
SPI_Down(buf,WLADDRESS+(j-1)/20*1000,1002);
BACK_COLOR=BLACK;
POINT_COLOR=BLUE;
LCD_ShowNum(20+16*5,160,j,6,16);
memset(buf,0x20,sizeof(buf));
}
}
}
else
{
//¶áè¡ê§°ü·μ»Ø
Show_Str(20,190,"ìõÂë¶áè¡′íÎó",16,1);
delay_ms(10000);
return;
}
if(i==FileInfo.F_Size)
break;
}
SOS:
if(j%20!=0)
{
//D′èëflash
memcpy(&buf[j%20*50],"AA",2);
SPI_Down(buf, WLADDRESS+((j-1)/20)*1000,1002);
BACK_COLOR=BLACK;
POINT_COLOR=BLUE;
LCD_ShowNum(20+16*5,160,j,6,16);
}
Show_Str(20,190,"μ¼èëíê3飬°′F2·μ»Ø",16,1);
while(1)
{
if(KEY_Scan()==11)
return ;
}
}
这是代码,请高手看看
一周热门 更多>