C8051FXXX单片机FLASH程序的自动升级
bsp; if ((ch>=0x30) && (ch<=0x39))
ru+=(ch-0x30)*16;
else if ((ch>=0x61) && (ch<=0x66))
ru+=((ch-0x61)+0x0a)*16;
fread(&ch,sizeof(unsigned char),1,fp);
if ((ch>=0x30) && (ch<=0x39))
ru+=ch-0x30;
else if ((ch>=0x61) && (ch<=0x66))
ru+=(ch-0x61)+0x0a;
fwrite(&ru,sizeof(unsigned char),1,fpw);
fread(&ch,sizeof(unsigned char),1,fp);/*0x0d*/
fread(&ch,sizeof(unsigned char),1,fp);/*0x0d*/
fread(&ch,sizeof(unsigned char),1,fp);/*0x0a*/
j++;
if (j==255)
{
j=0;
fread(&ch,sizeof(unsigned char),1,fp);
fread(&ch,sizeof(unsigned char),1,fp);
fread(&ch,sizeof(unsigned char),1,fp);
fread(&ch,sizeof(unsigned char),1,fp);
fread(&ch,sizeof(unsigned char),1,fp);
continue;
}
}
fclose(fp);fclose(fpw);
}
结束语
《C8051FXXX单片机FLASH程序的自动升级(第3页)》
本文链接地址:http://www.oyaya.net/fanwen/view/147310.html
ru+=(ch-0x30)*16;
else if ((ch>=0x61) && (ch<=0x66))
ru+=((ch-0x61)+0x0a)*16;
fread(&ch,sizeof(unsigned char),1,fp);
if ((ch>=0x30) && (ch<=0x39))
ru+=ch-0x30;
else if ((ch>=0x61) && (ch<=0x66))
ru+=(ch-0x61)+0x0a;
fwrite(&ru,sizeof(unsigned char),1,fpw);
fread(&ch,sizeof(unsigned char),1,fp);/*0x0d*/
fread(&ch,sizeof(unsigned char),1,fp);/*0x0d*/
fread(&ch,sizeof(unsigned char),1,fp);/*0x0a*/
j++;
if (j==255)
{
j=0;
fread(&ch,sizeof(unsigned char),1,fp);
fread(&ch,sizeof(unsigned char),1,fp);
fread(&ch,sizeof(unsigned char),1,fp);
fread(&ch,sizeof(unsigned char),1,fp);
fread(&ch,sizeof(unsigned char),1,fp);
continue;
}
}
fclose(fp);fclose(fpw);
}
结束语
以上所介绍的FLASH自动升级程序的PC部分在VC6.0及TC2.0中开发,并与805lFXXX系列的单片机联机成功,并最后用于在用户处的单片机FLASH程序升级。
《C8051FXXX单片机FLASH程序的自动升级(第3页)》