return -6;
default:
break;
}
}
return 0;
}
(5)实现训练的程序
void TrainSD()
{
while(TrainWord(NAME_ID,S_NAME) != 0) ; //训练名称
while(TrainWord(COMMAND_GO_ID,S_ACT1) != 0) ; //训练第1个动作
while(TrainWord(COMMAND_BACK_ID,S_ACT2) != 0) ; //训练第2个动作
while(TrainWord(COMMAND_LEFT_ID,S_ACT3) != 0) ; //训练第3个动作
while(TrainWord(COMMAND_RIGHT_ID,S_ACT4) != 0) ; //训练第4个动作
}
(6)实现储存语音模型的程序
void StoreSD()
{ unsigned int ulAddr,i,commandID,g_Ret;
F_FlashWrite1Word(0xef00,0xaaaa);
F_FlashErase(0xe000);
F_FlashErase(0xe100);
F_FlashErase(0xe200);
ulAddr=0xe000;//********
for(commandID=0x100;commandID<0x105;commandID++)
{
g_Ret=BSR_ExportSDWord(commandID);
while(g_Ret!=0) //模型导出成功?
g_Ret=BSR_ExportSDWord(commandID);
for(i=0;i<100;i++) //保存语音模型SD1(0xe000---0xe063)
{
F_FlashWrite1Word(ulAddr,BSR_SDModel[i]);
ulAddr+=1;
}
}
}
(7)实现装载语音模型的程序
void LoadSD()
{ unsigned int *p,k,jk,Ret,g_Ret;
p=(int *)0xe000; for(jk=0;jk<5;jk++)
{
for(k=0;k<100;k++)
{
Ret=*p;
g_Ret=BSR_ImportSDWord();
while(g_Ret!=0) //模型装载成功?
g_Ret=BSR_ImportSDWord(); SPCE061A语音控制小车设计+源代码(9):http://www.youerw.com/tongxin/lunwen_1001.html