我用8051控制ch375,液晶显示进行检测,发现U盘的初始化始终没法完成,初始化程序如下
ch375writecmd(0x51); del_5ms(); if(waitstatu()==0x14) { putstr(0," usb int success"); } else { putstr(0," usb int error! "); }
底层的3个读写函数是
unsigned char waitstatu(void) //等待并读取状态 { ch375_int=1; while(ch375_int); ch375writecmd(0x22); EA=1; return ch375readdata(); }
void ch375writecmd(unsigned char cmd) { P1=cmd; ch375_a0=1; ch375_rd=1; ch375_wr=0; ch375_cs=0; ; ch375_wr=1; ch375_cs=1; }
void ch375writedata(unsigned char value) { P1=value; ch375_a0=0; ch375_rd=1; ch375_wr=0; ch375_cs=0; ; ch375_wr=1; ch375_cs=1; }
unsigned char ch375readdata(void) { unsigned char value; P1=0xff; ch375_rd=0; ch375_wr=1; ch375_a0=0; ch375_cs=0; ; value=P1; ; ch375_rd=1; ch375_cs=1; return value; }
望指教,谢谢!!