CH376s初始化源代码如下:(btw程序在之前未加入lcd12864时候是没问题的)
s = mInitCH376Host( ); //初始化CH376
mStopIfError( s );
while ( CH376DiskConnect( ) != USB_INT_SUCCESS ) //检查U盘是否插入
{
mDelaymS( 100 );
}
mDelaymS( 200 );
for ( s = 0; s < 10; s ++ )
{
mDelaymS( 50 );
TI=1;
printf( "Ready ?\n" );
TI=0;
if ( CH376DiskMount( ) == USB_INT_SUCCESS ) break;//初始化磁盘并测试磁盘是否就绪,准备好
}
整一个的初始码:
u8 temp,s;
u16 t_delay = 0;
CurrentKey = 0;
P4SW = 0x70;//P4^4,P4^5,P4^6初始化为IO口 油泵I/O口
AD_Init();//AD初始化
AD_Chanl(1);
AD_Chanl(0);
UartInit();
LcdInit(); //Lcd12864初始化
LcdDispClear();//清屏
LcdDispStr(2,0," 启动中... ",0,1);
//空采
// for(t_delay = 0;t_delay < 5;t_delay ++){
// whichAD(1); //获取温度值
// whichAD(0); //获取水分值
// Get_dkcps();
// Delay(100); //100ms种启动延时
// }
Delay(40000); //25s启动延时
s = mInitCH376Host( ); //初始化CH376
mStopIfError( s );
while ( CH376DiskConnect( ) != USB_INT_SUCCESS ) //检查U盘是否插入
{
mDelaymS( 100 );
}
mDelaymS( 200 );
bee();
for ( s = 0; s < 10; s ++ )
{
mDelaymS( 50 );
TI=1;
printf( "Ready ?\n" );
TI=0;
if ( CH376DiskMount( ) == USB_INT_SUCCESS ) break;//初始化磁盘并测试磁盘是否就绪,准备好
}
bee();
LcdDispClear();//清屏
KeyFuncPtr = KeyTab[CurrentKey].CurrentOperate;//执行按键的操作
(*KeyFuncPtr)(); //执行当前的按键操作