CH376按写入U盘时无法写入超过512字节的文件,请问是什么原因?
程序代码如下:
unsigned char UART_Get_Char(void)
{
unsigned char cTm;
RI=0;
while(!RI);
cTm = SBUF;
RI = 0;
return cTm;
}
int WaitChar(int tn)
{
unsigned long ulTmo;
while(tn--)
{
for (ulTmo=0; ulTmo<40000; ulTmo++)
{
if (RI)
return 1;
}
}
return 0;
}
/*****************************************************
if(WaitChar(50))
{
for ((aa=Size/512); aa>=1; aa--)
{
for (i=0; i<512; i++ )
{
EA=0;
FileDataBuf[i]=UART_Get_Char();
EA=1;
if(i==511)
{
s=CH376SecWrite(FileDataBuf,1,NULL);
}
}
}
for(i=0;i<520;i++ )
FileDataBuf[i] = 0;
for(i=0;i<(Size%512);i++)
{
EA=0;
FileDataBuf[i]=UART_Get_Char();
EA=1;
}
s = CH376ByteWrite( FileDataBuf, (Size%512), NULL );
}