我每平均1秒往U盘里写一条数据作测试,一般在写到100条或1000条之间的时候,数据就写不进去了,单片机重启,可以继续写,但也是这样的结果,写着写着CH376S好像就不工作了一样,不知道是什么原因?
代码如下:
void WriteUdata(u16 CNT)
{
u8TarName[64];
u8 Ubuf[8];
u8 StartBuf[9] = {"Samsung:"};
u8 EndBuf[5] = {"\r\n"};
Ubuf[0] = CNT / 10000 + 0x30;
Ubuf[1] = (CNT % 10000)/1000 + 0x30;
Ubuf[2] = ((CNT % 10000)%1000)/100 + 0x30;
Ubuf[3] = ((CNT % 10000)%1000%100)/10 + 0x30;
Ubuf[4] = (CNT % 10000)%1000%100%10 + 0x30;
Ubuf[5] = 0x0A;
Ubuf[6] = 0x0D;
strcpy( (char *)TarName, "\\AAAAAAAA.TXT" );
si = CH376FileOpenPath(TarName);
CH376ByteLocate(0xFFFFFFFF);
mDelaymS(200);
mDelaymS(200);
si = CH376ByteWrite( StartBuf,9, NULL );
si = CH376ByteWrite( Ubuf,7, NULL );
si = CH376ByteWrite( EndBuf,5, NULL );
si = CH376FileClose( TRUE );
mDelaymS(200);
}