基于stc單片機(jī)的AT89S52離線燒錄器程序
UART_Send_Str("File_CDate:");
UART_Put_Num(fileinfo.File_CDate.year); UART_Send_Str("年");
UART_Put_Num(fileinfo.File_CDate.month);UART_Send_Str("月");
UART_Put_Num(fileinfo.File_CDate.day); UART_Send_Str("日");
UART_Put_Num(fileinfo.File_CTime.hour); UART_Send_Str("時(shí)");
UART_Put_Num(fileinfo.File_CTime.min); UART_Send_Str("分");
UART_Put_Num(fileinfo.File_CTime.sec); UART_Send_Str("秒");
UART_Put_Inf("File_StartClust:",fileinfo.File_StartClust);
UART_Put_Inf("File_CurClust:",fileinfo.File_CurClust);
UART_Put_Inf("File_CurSec:",fileinfo.File_CurSec);
UART_Put_Inf("File_CurPos:",fileinfo.File_CurPos);
UART_Put_Inf("File_CurOffset:",fileinfo.File_CurOffset);
UART_Send_Str("================================");
Pro_Enable();
UART_Send_Str("Program enable....");本文引用地址:http://butianyuan.cn/article/201611/323824.htm
Pro_ReadSign(psignbuf);
UART_Send_Str("Sign[0]:");
binary(psignbuf[0]);UART_Send_Enter();
UART_Send_Str("Sign[1]:");
binary(psignbuf[1]);UART_Send_Enter();
UART_Send_Str("Sign[2]:");
binary(psignbuf[2]);UART_Send_Enter();
Pro_Erase();
UART_Send_Str("Program erase....");
UART_Send_Str("Startprogramming....");
addr=0;
while(len=znFAT_ReadData(&fileinfo,fileinfo.File_CurOffset,32,code_buf))
{
for(i=0;i
while(!Write(code_buf[i],addr));
addr++;
}
UART_Send_Byte(.);
}
UART_Send_Enter();
Pro_Over();
UART_Send_Str("Program over....");
UART_Send_Str("Start to Play this Code....");
RST=1;
delay(1000);
RST=0;
for(i=0;i<100;i++)
{
delay(60000);
}
RST=1;
UART_Send_Str("Complete playing this Code");
znFAT_Close_File(&fileinfo);
n_file++;
res=znFAT_Open_File(&fileinfo,"/*.bin",n_file,1); //打開文件
}
//=================================================
if(res==ERR_NO_FILE) //出現(xiàn)無匹配文件錯(cuò)誤
{
UART_Put_Inf("Number of code file is ",n_file);
}
else
{
UART_Put_Inf("Have some Err:",res);
}
znFAT_Flush_FS(); //刷新文件系統(tǒng)
while(1);
}
評(píng)論