CH376U盘模块
执行程序蜂鸣器正常响 但是建立不了文件
void UART_init(void)
{
SCON = 0x50; //8-bit variable UART
TMOD |= 0x20; //Set Timer1 as 8-bit auto reload mode
TH1 = TL1 =-3;// -(FOSC/12/32/BAUD); //Set auto-reload vaule
TR1 = 1; //Timer1 start run
ES = 1; //Enable UART interrupt
EA = 1; //Open master interrupt switch
}
void SendData2(uchar dat)
{
while(TX2_busy);
TX2_busy=1;
SBUF = dat;
}
void SendString2(char *s) //////////′òó?×?·?′?
{
while (*s) //Check the end of the string
{
SendData2(*s++); //Send current char and increment string ptr
}
}
void DelayUS(unsigned int Time)
{
unsigned char i;
while(Time--)
{
for(i=0;i<20;i++);
}
}
void Uart_Isr() interrupt 4 using 1
{
if (RI)
{
RI = 0; //Clear receive interrupt flag
Rxbuff2=SBUF;
RX2_busy=0;
}
if (TI)
{
TI = 0; //Clear transmit interrupt flag
TX2_busy = 0; //Clear transmit busy flag
}
}
//////////////////////////////U?ì3ìDò////////////////////////////////
void xWriteCH376Cmd(uchar Cmd) // ?òCH376D′?üá?
{
SendData2(0x57);
DelayUS(1000);
SendData2(0xAB);
DelayUS(1000);
SendData2(Cmd);
}
void xWriteCH376Data(uchar mData)
{
SendData2(mData);
}
void main()
{
UART_init();
PortInit();
buzzer=0;
while(1)
{
xWriteCH376Cmd(0x06);
xWriteCH376Data(0x55);
if(Rxbuff2==0xaa)
{
DelayUS(1000);
Rxbuff2=0;
xWriteCH376Cmd(0x15); ///////????U?ì?£ê?
xWriteCH376Data(0x06);
}
if((Rxbuff2==0x51)||(Rxbuff2==0x15))
{
DelayUS(1000);
Rxbuff2=0;
xWriteCH376Cmd(0x30); ///////?ì2aU?ìê?·?á??ó
DelayUS(1000);
Rxbuff2=0;
xWriteCH376Cmd(0x31);//////////3?ê??ˉU?ì
DelayUS(1000);
Rxbuff2=0;
xWriteCH376Cmd(0x2F); ///////′′?¨???t?üá?
SendString2("/CDE.TXT");
xWriteCH376Cmd(0x34); ///////′′?¨???t
DelayUS(1000);
Rxbuff2=0;
xWriteCH376Cmd(0x22); ////////??è??D??×′ì?
// }
}
if(Rxbuff2==0x56)
{
buzzer=1;
}
// }
// }
}
}
?
串口转USB。你的问题能在说细点吗?
是FAT文件问题吗?