void SendOneByteToCh376(Uint08 Data)
{
USART_ClearFlag(USART1,USART_FLAG_TC);
USART_SendData(USART1,Data);
while(USART_GetFlagStatus(USART1,USART_FLAG_TC)==RESET);
}
void SendCmdToCh376(Uint08 Cmd)
{
SendOneByteToCh376(0x57);
SendOneByteToCh376(0xAB);
SendOneByteToCh376(Cmd);
}
Uint16 WriteReqDataBlock(Uint08 *Buf)
{
Uint16 BlockLen,BlockLenBak;
SendCmdToCh376(WriteReqData);
BlockLenBak=BlockLen=GetCh376IntStatus();
if(BlockLen)
{
do
{
// SendOneByteToCh376(*Buf++);
SendOneByteToCh376('1');
}while(--BlockLen);
}
return(BlockLenBak);
}
void ByteWriteCh376(Uint08 *Buf,Uint32 Len)
{
Uint16 BlockLen;
SendCmdToCh376(Byte_Write);
SendOneByteToCh376((Uint08)Len);
SendOneByteToCh376((Uint08)(Len>>8));
while(1)
{
if(GetCh376IntStatus() == USB_DISK_WRITE)
{
BlockLen=WriteReqDataBlock(Buf);
SendCmdToCh376(Byte_Write_Go);
Buf = Buf + BlockLen;
}
else
{
break;
}
}
}
创建文件,打开文件都正常,444个字节的数据要写入文件;“if(GetCh376IntStatus() == USB_DISK_WRITE)”第一二次都是0x1E,第三次是0x14,“BlockLen=WriteReqDataBlock(Buf);”第一次返回0xFF,第二次返回0xBD,合计也是444字节,这些都显示向文件写数据是成功的,但是在PC上打开文件看不到写入的数据。请专家指导,谢谢!
另:文件的创建时间怎么解决?