文件名称:手里的单片机项目详细
文件大小:77KB
文件格式:DSN
更新时间:2016-03-13 15:25:41
项目
#define P_IOA_Data (volatile unsigned int *)0x7000 #define P_IOA_Buffer (volatile unsigned int *)0x7001 #define P_IOA_Dir (volatile unsigned int *)0x7002 #define P_IOA_Attrib (volatile unsigned int *)0x7003 #define P_IOA_Latch (volatile unsigned int *)0x7004 #define P_IOB_Data (volatile unsigned int *)0x7005 #define P_IOB_Buffer (volatile unsigned int *)0x7006 #define P_IOB_Dir (volatile unsigned int *)0x7007 #define P_IOB_Attrib (volatile unsigned int *)0x7008 #define P_Watchdog_Clear (volatile unsigned int *)0x7012 #define P_SystemClock (volatile unsigned int *)0x7013 #include "bsrsd.h" #include "hardware.h" #define NAME_ID 0x100 #define COMMAND_ONE_ID 0x101 #define COMMAND_TWO_ID 0x102 #define COMMAND_THREE_ID 0x103 #define COMMAND_FORE_ID 0x104 #define COMMAND_FIVE_ID 0x105 #define COMMAND_SIX_ID 0x106 #define COMMAND_SEVEN_ID 0x107 #define RSP_INTR 0 #define RSP_NAME 1 #define RSP_FIRE 2 #define RSP_GUARD 3 #define RSP_AGAIN 4 #define RSP_NOVOICE 5 #define RSP_NAMEDIFF 6 #define RSP_CMDDIFF 7 #define RSP_STAR 8 #define RSP_MASTER 9 #define RSP_HERE 10 #define RSP_GUNSHOT 0 #define RSP_PATROL 11 #define RSP_READY 12 #define RSP_COPY 13 #define RSP_NOISY 14 extern unsigned int BSR_SDModel[100]; unsigned int commandID; unsigned int g_Ret; //..................全程变量.................... int gActivated = 0; //该变量用于检测是否有触发命令,当有识别出语句 //为触发名称则该位置1 int gTriggerRespond[] = {RSP_MASTER, RSP_HERE, RSP_MASTER}; int gComm2Respond[] = {RSP_PATROL, RSP_READY, RSP_COPY}; extern void ClearWatchDog(); int PlayFlag = 0; unsigned int uiSpeed=0; //unsigned int *ClearWatchdog = 0x7012; void PlayRespond2(int Result) { BSR_StopRecognizer(); SACM_A2000_Initial(1); SACM_A2000_Play(Result, 3, 3); while((SACM_A2000_Status()&0x0001;) != 0) { SACM_A2000_ServiceLoop(); ClearWatchDog(); } SACM_A2000_Stop(); BSR_InitRecognizer(BSR_MIC); BSR_EnableCPUIndicator(); } void PlayRespond(int Result) { BSR_StopRecognizer(); SACM_S480_Initial(1); SACM_S480_Play(Result, 3, 3); while((SACM_S480_Status()&0x0001;) != 0) { SACM_S480_ServiceLoop(); ClearWatchDog(); } SACM_S480_Stop(); BSR_InitRecognizer(BSR_MIC); BSR_EnableCPUIndicator(); } int TrainWord(int WordID, int RespondID) { int res; PlayRespond(RespondID); while(1)。。。。。。。