This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

低电感电机lab05b如何修改控制程序

Other Parts Discussed in Thread: DRV8301

28069M+drv8301 电机公牛BR2804-1700Kv-1型三相无刷直流电机,在lab05b中能不能修改程序,实现如下功能:

上电后,10秒后自动启动电动机运行,初始速度为2000rpm,运行10秒后速度调整为4000rpm,运行10秒后速度调整为6000rpm,运行10秒停止电机,之后重复上述过程。

  • 可以的,如果对延时时间不需要很准确的话,可以在后台主循环中添加一个定时器来实现这个控制流程。
    1、定义一个全局变量作为时间计数器,并在ISR中计数。
    2、在后台主循环之前,设置gMotorVars.Flag_enableSys为“true”。
    3、将gmotorvars.flag_run_identify设置为“true”,并将gmotorvars.speedref_krpm设置为设置时间结束时的目标速度。
    4、将gmotorvars.flag_run_identify设置为“false”,并将gmotorvars.speedref_krpm设置为设置时间结束时的目标速度。
    5、重复步骤3和4。