|
本帖最后由 mmuuss586 于 2018-12-14 14:01 编辑 基于STM32F0+L6474步进驱动开源分享:源码+原理图+BOM表等全部开源 基本功能:细分设置、电流设置、软件启动、停止、正反转、加减速、回原点、回参考点等你想到的功能都有 主芯片:STM32F030R8T6(NUCLEO板都支持) 软件:KEIL MDK打开(5.0以上版本) 资料下载:见附件 原创:游名 //----- 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 |
STM32
超强工具——STM32CubeMX 你会用吗?
集结出发! STM32全国研讨会系列之一:ST智能门铃中国首秀
关于STM32启动文件的几个小问题
【银杏科技ARM+FPGA双核心应用】STM32H7系列35——USB_VCP_FS
【银杏科技ARM+FPGA双核心应用】STM32H7系列28——USB_HID
粉丝分享 | 图说CRC原理应用及STM32硬件CRC外设
STM32L151进入低功耗,并由RTC唤醒的故事
[转]stm32控制NFC模块(PN532)源码(P2P,模拟卡,读写卡等
STM32G070RB+LVGL移植
微信公众号
手机版
谢谢支持;
谢谢支持