- 1、本文档共11页,可阅读全部内容。
- 2、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
- 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
比较稳定(Relatively stable)
比较稳定(Relatively stable)
#包括 stdio. h
#包括 lm3sxxxx。”
/ / PWM产生端口
#定义PWM2 gpio_pin_0 / * * / PB0
#定义PWM3 gpio_pin_1 / * * / PB1
/ /红外所在口定义
/ /分别对应着四个红外(1,2,3,4)
#定义试验(gpio_pin_2 | gpio_pin_3 | gpio_pin_4 | gpio_pin_5)
#定义rl_14(gpio_pin_2 | gpio_pin_5)
#定义rl_23(gpio_pin_3 | gpio_pin_4)
#定义rl_1 gpio_pin_2
#定义rl_2 gpio_pin_3
#定义rl_3 gpio_pin_4
#定义rl_4 gpio_pin_5
#定义leftspeed 264 / /左速度左轮速度宏定义
#定义rightspeed 400
#定义leftbackspeed 250 / /左后卫速度左轮倒转速度宏定义
#定义rightbackspeed 400
#定义speedrate 0.35 / / 65%的速度减速比例宏定义
#文定350000定义
//不稳定的无符号char;
空延迟(无符号长整型)
{
虽然(T -);
}
无效pwm_init()
{
配置8mhz外部晶振作为主时钟* / / *
sysctlclockset(sysctl_sysdiv_1 | sysctl_use_osc | sysctl_osc_main | sysctl_xtal_8mhz);
* enable PWM2 and PWM3 output is GPIO.
SysCtlPeripheralEnable (SYSCTL_PERIPH_GPIOB);
/ * set E port PW2 and PW3 port driver energy is 8MA, and set up a pull-up resistor.
GPIOPadConfigSet (GPIO_PORTB_BASE, PWM2 | PWM3, GPIO_STRENGTH_8MA, GPIO_PIN_TYPE_STD_WPU);
Enable the PWM module / * * /
SysCtlPeripheralEnable (SYSCTL_PERIPH_PWM);
PWM clock configuration: 4 / * * / divider
SysCtlPWMClockSet (SYSCTL_PWMDIV_4);
PB0 and PB1 / * configuration for the PWM function.
GPIOPinTypePWM (GPIO_PORTB_BASE, GPIO_PIN_0 | GPIO_PIN_1);
Configure the PWM generator 1: / * * / counted
PWMGenConfigure (PWM_BASE, PWM_GEN_1, PWM_GEN_MODE_UP_DOWN | PWM_GEN_MODE_NO_SYNC);
Set / PWM / * cycle generator 1
PWMGenPeriodSet (PWM_BASE, PWM_GEN_1, 40000);
* enable output / PWM2 and PWM3
PWMOutputState (PWM_BASE (PWM_OUT_2_BIT | PWM_OUT_3_BIT), true);
PWMGenEnable (PWM_BASE, PWM_GEN_1);
}
小车和红外初始化/ * * /
无效car_init()
{
pwmpulsewidthset(pwm_base,pwm_out_23000);/ /左轮3400前进
pwmpulsewidthset(pwm_base,pwm_out_33000);/ /右轮2600前进
sysctlperipheralenable(sysctl_periph_gpiob);
gpiopadconfigset(gpio_portb_base,试验,gpio_strength_2ma,gpio_pin_type_std);/ /没有上拉或下拉电阻
gpiodirmodeset(gpio_portb_base,试验,gpio_dir_mode_in);/ /设为输入
}
/ ******小车动作********** /
无效small_right() /小右移
{
pwmpulsewidthset(pwm_base,pwm_out_2,3000 + leftspeed);
pwmpulsewidth
您可能关注的文档
- 检验见习(Test Trainee).doc
- 植入式广告及运用策略(Implantable advertising and its application strategy).doc
- 植入式广告对品牌消费心理的影响与思考(Influence of embedded advertisement on brand consumption psychology).doc
- 植入式广告,开创药品大传播新途径!(内部文件)(Implantable advertising creates a new way to spread drugs. (internal documents)).doc
- 植入式广告整合营销《丑女无敌》全案解析(Implantable advertising integrated marketing ugly invincible whole case analysis).doc
- 植入式广告热的冷思考(Cool thinking about the heat of product advertisement).doc
- 棒球名称日文对照(Baseball name Japanese comparison).doc
- 植物和人体的新陈代谢(Metabolism of plants and human bodies).doc
- 检测技术基础(Detection technology basis).doc
- 植物激素(Plant hormone).doc
最近下载
- 风力发电机模拟软件:FAST二次开发_(3).FAST模拟器架构解析.docx VIP
- 语文三年级下册专项训练:阅读.doc VIP
- 金属制品项目企业经营战略方案.docx
- 人工智能导论课件 第十三章 类脑智能.pptx VIP
- 招聘面试题大全.doc VIP
- 北师大版小学数学六年级下册各单元思维导图.pdf
- 中考物理常考估测汇总及估测训练100题(模拟50题+真题50题)(原卷版).docx VIP
- 岩壁梁悬臂模板施工方案.docx VIP
- 碳纤维片材加固混凝土结构技术规程(2007年版) CECS146:2003.pdf VIP
- 新人教版(2025)小学三年级英语下册第六单元Unit 6 单元整体教学设计.docx VIP
文档评论(0)