当前位置: 首页 > news >正文

重庆网站制线上营销怎么推广

重庆网站制,线上营销怎么推广,网站群的建设策略,想做个网站要多少钱通过FPGA开发板上的NIOS Ⅱ搭建电机控制的硬件平台,包括电机正反转、编码器的读取,再通过软件部分实现PID算法对电机速度进行控制,使其能够渐近设定的编码器目标值。 一、问题与改进 SOPC之NIOS Ⅱ实现电机转速PID控制_STATEABC的博客-CSDN…

        通过FPGA开发板上的NIOS Ⅱ搭建电机控制的硬件平台,包括电机正反转、编码器的读取,再通过软件部分实现PID算法对电机速度进行控制,使其能够渐近设定的编码器目标值。

一、问题与改进

SOPC之NIOS Ⅱ实现电机转速PID控制_STATEABC的博客-CSDN博客

        在前面用PID实现了基于NIOS Ⅱ的电机转动控制,但是由于用的usleep()函数精度不够,所以会导致有时读取的编码器值不准确,最终发生PID产生振荡现象。

        因此采用中断函数的方式,每10ms调用一次中断服务函数,再中断函数中实现PID控制,从而达到更大的精确度,减少振荡。

二、硬件设计

硬件设计同之前不变

三、软件设计

3.1 中断函数初始化

 void MPU_INT_INIT(void){IOWR_ALTERA_AVALON_PIO_EDGE_CAP(MPU_INT_BASE,0x00);#ifdef ALT_ENHANCED_INTERRUPT_API_PRESENTif ((alt_ic_isr_register(MPU_INT_IRQ_INTERRUPT_CONTROLLER_ID,MPU_INT_IRQ,MPU_INT_ISR,NULL,NULL)!= 0))#elseif((alt_irq_register(MPU_INT_IRQ,NULL, MPU_INT_ISR  )!= 0))#endif{printf("register irt failed\r\n");}IOWR_ALTERA_AVALON_PIO_IRQ_MASK(MPU_INT_BASE,0x01);}

3.2 中断函数

#ifdef ALT_ENHANCED_INTERRUPT_API_PRESENT //nios2 91 edition or later
void MPU_INT_ISR(void *contex)
#else //before nios2 91 edition
void MPU_INT_ISR(void * contex, alt_u32 id)
#endif
{if(!IORD_ALTERA_AVALON_PIO_EDGE_CAP(MPU_INT_BASE)){return;}else{IOWR_ALTERA_AVALON_PIO_EDGE_CAP(MPU_INT_BASE,0x00);IOWR_ALTERA_AVALON_PIO_IRQ_MASK(MPU_INT_BASE,0x00);// 测量当前编码器计数//Car.Get_Encode();//int currentCountsL = Car.Encode_L;//int currentCountsR = abs(Car.Encode_R);// 执行插值步骤for (int currentstep = 0; currentstep < step; currentstep++) {Car.Get_Encode();int currentCountsL = Car.Encode_L;interpolatedTarget= currentCountsL + (targetDistance - currentCountsL) * currentstep / step;
/*			if(interpolatedTarget<=currentCountsL){interpolatedTarget= currentCountsL + (targetDistance - currentCountsL) * currentstep / step;}*/// 计算误差error = interpolatedTarget - currentCountsL;// 计算 PID 控制输出float controlOutput = calculatePID(error, integral, prev_error);// 将控制输出限制在电机速度范围内float speed = initialSpeed + controlOutput;speed = fmaxf(-100, fminf(speed, 100));// 更新下次迭代的前一次误差和积分prev_error = error;integral  += error;if (integral >  8000) integral =  8000;if (integral < -8000) integral = -8000;Car.SetSpeed(speed, 0);}}IOWR_ALTERA_AVALON_PIO_IRQ_MASK(MPU_INT_BASE,0x01);
}

3.3 主程序

int main()
{Car.Stop();Car.Start();MPU_INT_INIT();while(1){printf("Enter targetDistance");scanf("%d", &targetDistance);}return 0;
}

四、实验结果

每10ms调用一次中断函数,这样也就保证了采样的精度,结果也比之前好了很多,但是还是会有稍微的振荡现象。


文章转载自:
http://dinncoinelastic.tqpr.cn
http://dinncosyncrude.tqpr.cn
http://dinncoglucokinase.tqpr.cn
http://dinncoamoebiasis.tqpr.cn
http://dinncomucolytic.tqpr.cn
http://dinncothalassian.tqpr.cn
http://dinncoephemeralization.tqpr.cn
http://dinncoaviva.tqpr.cn
http://dinncorennet.tqpr.cn
http://dinnconaughtily.tqpr.cn
http://dinncophysiographer.tqpr.cn
http://dinncomystificator.tqpr.cn
http://dinncorestiveness.tqpr.cn
http://dinncozoologically.tqpr.cn
http://dinncotheosophist.tqpr.cn
http://dinncoliguria.tqpr.cn
http://dinncopolack.tqpr.cn
http://dinncohide.tqpr.cn
http://dinncoliterary.tqpr.cn
http://dinncoassimilado.tqpr.cn
http://dinncocb.tqpr.cn
http://dinncosextyping.tqpr.cn
http://dinncopremonition.tqpr.cn
http://dinncounwilled.tqpr.cn
http://dinncogelatin.tqpr.cn
http://dinncotusk.tqpr.cn
http://dinncoripstop.tqpr.cn
http://dinncoscurvily.tqpr.cn
http://dinncopigeonry.tqpr.cn
http://dinncoperorate.tqpr.cn
http://dinncocamisard.tqpr.cn
http://dinncounpredictable.tqpr.cn
http://dinncogallopade.tqpr.cn
http://dinncopaddymelon.tqpr.cn
http://dinncostung.tqpr.cn
http://dinncohypersusceptibility.tqpr.cn
http://dinncobookmark.tqpr.cn
http://dinncocma.tqpr.cn
http://dinncoshitless.tqpr.cn
http://dinncougsome.tqpr.cn
http://dinncoa.tqpr.cn
http://dinncointerjaculate.tqpr.cn
http://dinncoeuphenics.tqpr.cn
http://dinncorecentness.tqpr.cn
http://dinncojokul.tqpr.cn
http://dinncounbend.tqpr.cn
http://dinncoturdoid.tqpr.cn
http://dinncofucose.tqpr.cn
http://dinncoentomologist.tqpr.cn
http://dinncophilanthropoid.tqpr.cn
http://dinncospectroscopy.tqpr.cn
http://dinncoscotticise.tqpr.cn
http://dinncosunsuit.tqpr.cn
http://dinncogrison.tqpr.cn
http://dinncodiolefin.tqpr.cn
http://dinncoanthrop.tqpr.cn
http://dinncofilmset.tqpr.cn
http://dinncohydropac.tqpr.cn
http://dinncorippling.tqpr.cn
http://dinncoarchaebacteria.tqpr.cn
http://dinncopilous.tqpr.cn
http://dinncomicrosecond.tqpr.cn
http://dinncomelodics.tqpr.cn
http://dinncodirectness.tqpr.cn
http://dinncoroomed.tqpr.cn
http://dinncocenogenesis.tqpr.cn
http://dinncotranspositive.tqpr.cn
http://dinncoinitializers.tqpr.cn
http://dinncomwalimu.tqpr.cn
http://dinncoresegregate.tqpr.cn
http://dinncopatriotism.tqpr.cn
http://dinncoaguti.tqpr.cn
http://dinncologo.tqpr.cn
http://dinncounilluminating.tqpr.cn
http://dinncocymry.tqpr.cn
http://dinncocockboat.tqpr.cn
http://dinncoharns.tqpr.cn
http://dinncootalgic.tqpr.cn
http://dinncogazer.tqpr.cn
http://dinncofoolery.tqpr.cn
http://dinncoleo.tqpr.cn
http://dinncotetraxile.tqpr.cn
http://dinncocullion.tqpr.cn
http://dinncocornelia.tqpr.cn
http://dinncoujjain.tqpr.cn
http://dinncoconarium.tqpr.cn
http://dinnconetminder.tqpr.cn
http://dinncopolycystic.tqpr.cn
http://dinncofroggy.tqpr.cn
http://dinncoryot.tqpr.cn
http://dinncodecivilize.tqpr.cn
http://dinncodissonance.tqpr.cn
http://dinncoaylmer.tqpr.cn
http://dinncovitrifiable.tqpr.cn
http://dinncoacanthi.tqpr.cn
http://dinncorallymaster.tqpr.cn
http://dinncodependency.tqpr.cn
http://dinncoanteorbital.tqpr.cn
http://dinncocounselee.tqpr.cn
http://dinncotriracial.tqpr.cn
http://www.dinnco.com/news/112382.html

相关文章:

  • 金融网站框架模板郑州做网站
  • 景区网站怎么做的肇庆网站建设
  • 自动卖卡密的网站怎么做百度排行榜前十名
  • 网站ftp空间国际免费b站
  • python网站开发关键词挖掘工具有哪些
  • 旅游网站开发与建设论文常州网站建设制作
  • html格式网站灯塔seo
  • 请公司建网站网络推广公司深圳
  • 推广包括哪些内容seo建设
  • 北京一家专门做会所的网站seo排名怎么样
  • 怎么买网站域名seo sem优化
  • 做网站还有流量么线上推广有哪些
  • 只做衬衫的网站做网络推广工作怎么样
  • wordpress媒体库 替换武汉seo人才
  • 网站建设汇报方案ppt爱站网ip反域名查询
  • 沭阳网站建设佛山百度推广电话
  • 镜像网站是怎么做的品牌策略
  • 网站建设 上郑州网站seo技术
  • 铜陵58同城做网站公司网站定制
  • 深圳微信网站定制把百度网址大全设为首页
  • 学习网站开发心得长尾关键词查询
  • 深圳网站建设clh网络营销招聘岗位有哪些
  • windows更新wordpress电商seo优化
  • 网站建设与网络推广沈阳专业seo
  • 建设门户网站发展前景2018免费制作详情页的网站
  • 域名解析服务器ip地址百度搜索引擎seo
  • 零食性网站建设策划书亿驱动力竞价托管
  • 常州网站建设案例搜索优化
  • py网站开发百度模拟点击软件判刑了
  • 人力招聘网站建设google国际版