欢迎来到天天文库
浏览记录
ID:15124009
大小:590.00 KB
页数:55页
时间:2018-08-01
《嵌入式多模态智能轮椅控制程序》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库。
1、嵌入式多模态人机交互智能轮椅控制程序目录一主程序1二键盘扫描程序2三超声波自主避障模态程序8四语音控制模态程序22五视觉自主导航模态程序32六DA转换模块程序5054一主程序主程序流程图Main.c文件#include"SPCE061A.h"externvoidInitial_ult(void);externvoidInitial();externvoidmotor_init(void);externvoidKey_judge(void);intmain(void){Initial();//键盘,指
2、示灯初始化Initial_ult();//超声波IO初始化motor_init();//DA初始化while(1){Key_judge();*P_Watchdog_Clear=0x0001;}//endwhile}//endmain54二键盘扫描程序16KEYSCAN.h文件#ifndef__16KEYSCAN_h__#define__16KEYSCAN_h__//writeyourheaderhere#include"SPCE061A.h"#include"SpeechControl.h"#inc
3、lude"vision.h"#include"IOBit.h"#defineuintunsignedint#defineuiSDModelAddr_team10xf600//第一组SDModel的FLASH首地址#defineRSP_CHANGESTATE17//请切换至语音识别状态externvoidvision_navigation(void);externvoidsample_init(void);externuintBZ_back(uintBZ_flag);externuintBZ_ahea
4、d(uintBZ_flag,uintk);externuintBZ_HT_left(uintBZ_flag);externuintBZ_HT_right(uintBZ_flag);externvoidPlaySnd(uintSndID,uintDAC_Channel);externvoidF_FlashFormat(void);externvoidBZ_stop(void);externvoiddelayms(uintmsNum);externvoidback(void);externvoidrig
5、ht(unsignedintdata1,unsignedintdata2);externvoidleft(unsignedintdata1,unsignedintdata2);externvoidahead(unsignedintdata);externvoidstop(void);externuintBZ_flag;unsignedintinterrupt_flag=0;unsignedintone_flag=0;unsignedintfusion_flag=0;uintuiKey;#endif5
6、416KeyScan.c文件#include"16KeyScan.h"//含有6个函数:delayms()Initial()Key_Scan()Key_judge()Key_stop()Key_stop2()//=================毫秒延时子程序==========================voiddelayms(uintmsNum){uinti,j;for(j=0;j7、cycles}*P_Watchdog_Clear=0x0001;}}//=================键盘,指示灯初始化=======================voidInitial(void){*P_IOA_Attrib=0x00e7;//A3-A4输入,A5-A7输出,A0-2为指示灯初始化为高电平*P_IOA_Dir=0x00e7;*P_IOA_Data=0xffe0;//下拉输入*P_IOB_Attrib=0xfff3;*P_IOB_Dir=0xfff3;*P_IOB_Data=08、xffec;}//=================键盘扫描,读取键值========================unsignedintKey_Scan(void){unsignedintuiTemp;*P_IOA_Data=*P_IOA_Data9、0x00e0;//IOA5-IOA7输出高电平,有键按下则IOA3-IOA4输入不全为0。uiTemp=0x0018&*P_IOA_Data;//IOA3-IOA4位不变,其余位变成0。if(uiTemp==0)ret
7、cycles}*P_Watchdog_Clear=0x0001;}}//=================键盘,指示灯初始化=======================voidInitial(void){*P_IOA_Attrib=0x00e7;//A3-A4输入,A5-A7输出,A0-2为指示灯初始化为高电平*P_IOA_Dir=0x00e7;*P_IOA_Data=0xffe0;//下拉输入*P_IOB_Attrib=0xfff3;*P_IOB_Dir=0xfff3;*P_IOB_Data=0
8、xffec;}//=================键盘扫描,读取键值========================unsignedintKey_Scan(void){unsignedintuiTemp;*P_IOA_Data=*P_IOA_Data
9、0x00e0;//IOA5-IOA7输出高电平,有键按下则IOA3-IOA4输入不全为0。uiTemp=0x0018&*P_IOA_Data;//IOA3-IOA4位不变,其余位变成0。if(uiTemp==0)ret
此文档下载收益归作者所有