电磁组智能车简介

整理文档很辛苦,赏杯茶钱您下走!

免费阅读已结束,点击下载阅读编辑剩下 ...

阅读已结束,您可以下载文档离线阅读编辑

资源描述

电磁组智能车2013Dec.11thFreescaleSmartCarcatalog电磁组小车运行原理控制方法硬件介绍编译环境一、电磁组小车运行原理1.车模通过感应由赛道中心导线产生的交变磁场进行路径检测2.要让小车自己沿着赛道跑就要让小车能通过传感器的信号自动的识别当前所处的位置,以及距离赛道中心的大概距离。我们通过制作传感器来采集模拟信号,然后传给单片机,然后编程来实现小车位置的判别以及控制小车采取相应动作。2、控制方法磁PID算法:速度PID算法:PID控制算法:测量关心的变量,与期望值相比较,用这个误差纠正调节为了控制舵机打角控制系统的响应。主要用了偏差控制:采集、计算偏差,修正偏差,以使控制量趋近于目标值。为了控制电机速度的恒定系统框图三、硬件介绍1.电磁传感器(即电感)2.光电编码器3.电机4.舵机5.车模6.主控芯片电路板1、16位单片机所用编译软件:CodeWarrior四、编译环境2、32位单片机所用编译软件:IARHelloTomorrow!ProjectsPrograms/********************************************************************//*!*\briefKinetisIdentify*\returnNone**Thisisprimarlyareportingfunctionthatdisplaysinformation*aboutthespecificCPUtothedefaultterminalincluding:*-Kinetisfamily*-package*-dierevision*-P-flashsize*-Ramsize*/|voidcpu_identify(void)|{|/*DeterminetheKinetisfamily*/|switch((SIM_SDID&SIM_SDID_FAMID(0x7))SIM_SDID_FAMID_SHIFT)|{|case0x0:|printf(\nK10-);|break;|case0x1:|printf(\nK20-);|break;|case0x2:|printf(\nK30-);|break;|case0x3:|printf(\nK40-);|break;|case0x4:|printf(\nK60-);|break;|case0x5:|printf(\nK70-);|break;|case0x6:|printf(\nK50-);|break;|case0x7:|printf(\nK53-);|break;|default:|printf(\nUnrecognizedKinetisfamilydevice.\n);|break;|}/*****************************************/Volumeserialnumberis706C-C11EEXTI.H#ifndef_EXTI_H_#define_EXTI_H_typedefenumexti_cfg{zero_down=0x08u,//低电平触发,内部下拉rising_down=0x09u,//上升沿触发,内部下拉falling_down=0x0Au,//下降沿触发,内部下拉either_down=0x0Bu,//跳变沿触发,内部下拉one_down=0x0Cu,//高电平触发,内部下拉//用最高位标志上拉和下拉zero_up=0x88u,//低电平触发,内部上拉rising_up=0x89u,//上升沿触发,内部上拉falling_up=0x8Au,//下降沿触发,内部上拉either_up=0x8Bu,//跳变沿触发,内部上拉one_up=0x8Cu//高电平触发,内部上拉+----}exti_cfg;voidexti_init(PORTx,uint8n,exti_cfg);#endif|if(MC_SRSH&MC_SRSH_SW_MASK)|printf(SoftwareReset\n);|if(MC_SRSH&MC_SRSH_LOCKUP_MASK)|printf(CoreLockupEvent|Reset\n);|if(MC_SRSH&MC_SRSH_JTAG_MASK)|printf(JTAGReset\n);||if(MC_SRSL&MC_SRSL_POR_MASK)|printf(Power-onReset\n);|if(MC_SRSL&MC_SRSL_PIN_MASK)|printf(ExternalPinReset\n);|if(MC_SRSL&MC_SRSL_COP_MASK)||printf(Watchdog(COP)|Reset\n);|if(MC_SRSL&MC_SRSL_LOC_MASK)|printf(LossofClockReset\n);|if(MC_SRSL&MC_SRSL_LVD_MASK)|printf(Low-voltageDetect|Reset\n);|if(MC_SRSL&MC_SRSL_WAKEUP_MASK)|printf(LLWUReset\n);|/********************************************************************///functionprototypesvoidsysinit(void);voidtrace_clk_init(void);voidfb_clk_init(void);voidenable_abort_button(void);/********************************************************************/\---Headers:/*SRSHBitFields*/#defineMC_SRSH_JTAG_MASK0x1u#defineMC_SRSH_JTAG_SHIFT0#defineMC_SRSH_LOCKUP_MASK0x2u#defineMC_SRSH_LOCKUP_SHIFT1#defineMC_SRSH_SW_MASK0x4u#defineMC_SRSH_SW_SHIFT2/*SRSLBitFields*/#defineMC_SRSL_WAKEUP_MASK0x1u#defineMC_SRSL_WAKEUP_SHIFT0#defineMC_SRSL_LVD_MASK0x2u#defineMC_SRSL_LVD_SHIFT1#defineMC_SRSL_LOC_MASK0x4u#defineMC_SRSL_LOC_SHIFT2#defineMC_SRSL_COP_MASK0x20u#defineMC_SRSL_COP_SHIFT5#defineMC_SRSL_PIN_MASK0x40u#defineMC_SRSL_PIN_SHIFT6#defineMC_SRSL_POR_MASK0x80u#defineMC_SRSL_POR_SHIFT7/*PMPROTBitFields*/#defineMC_PMPROT_AVLLS1_MASK0x1u#defineMC_PMPROT_AVLLS1_SHIFT0#defineMC_PMPROT_AVLLS2_MASK0x2u#defineMC_PMPROT_AVLLS2_SHIFT1#defineMC_PMPROT_AVLLS3_MASK0x4u#defineMC_PMPROT_AVLLS3_SHIFT2#defineMC_PMPROT_ALLS_MASK0x10u#defineMC_PMPROT_ALLS_SHIFT4#defineMC_PMPROT_AVLP_MASK0x20u#defineMC_PMPROT_AVLP_SHIFT5Thanks

1 / 13
下载文档,编辑使用

©2015-2020 m.777doc.com 三七文档.

备案号:鲁ICP备2024069028号-1 客服联系 QQ:2149211541

×
保存成功