//-----Increase deceleration while running
/* Increase deceleration of device 0 to 480 step/s^2 */ //减速度测试
BSP_MotorControl_SetDeceleration(0,480); //设置减速度为480
HAL_Delay(5000); //延时5S
/* Decrease speed of device 0 to 1200 step/s */
BSP_MotorControl_SetMaxSpeed(0,1200); //设置最高速度为1200
HAL_Delay(5000); //延时5S
/* Get current speed */
mySpeed = BSP_MotorControl_GetCurrentSpeed(0); //获取当前速度
//----- Soft stopped required while running //电机运转时:软件停止电机运转测试
/* Request soft stop of device 0 */
BSP_MotorControl_SoftStop(0); //发送软件停止指令
/* Wait for the motor of device 0 ends moving */
BSP_MotorControl_WaitWhileActive(0); //等待电机停止运转
/* Wait for 2 seconds */
HAL_Delay(2000); //延时2S
//----- Run stopped by hardstop
/* Request device 0 to run in FORWARD direction */
BSP_MotorControl_Run(0,FORWARD); //电机正转
HAL_Delay(5000); //延时5S
/* Request device 0 to immediatly stop */
BSP_MotorControl_HardStop(0); //电机硬件停止
BSP_MotorControl_WaitWhileActive(0); //等待电机停转
/* Request device 0 to disable bridge */
BSP_MotorControl_CmdDisable(0); //关闭电机驱动H桥, 关闭后,手旋转电机就可以转的动,要不然转不动;
/* Wait for 2 seconds */
HAL_Delay(2000); //延时2S
//----- GOTO stopped by softstop //移动到目标点过程中:软件停止测试
/* Request device 0 to go to position 20000 */
BSP_MotorControl_GoTo(0,20000); //发送移动20000步命令
HAL_Delay(5000); //延时5S
/* Request device 0 to perform a soft stop */
BSP_MotorControl_SoftStop(0); //软件停止
BSP_MotorControl_WaitWhileActive(0); //等待电机停止
/* Wait for 2 seconds */
HAL_Delay(2000); //延时2S
42步进电机资料.rar
(561.16 KB, 下载次数: 234)