谁有基于51单片机的步进电机C程序 可实现启动 停止 加减速 并显示等 找了半天没找到,51单片机步进电机模块化编程

首页 > 科技 > 作者:YD1662025-05-01 02:52:08

谁有基于51单片机的步进电机C程序 可实现启动 停止 加减速 并显示等 找了半天没找到,51单片机步进电机模块化编程(1)

#include

unsigned char code F_Rotation[4]={0x08,0x10,0x20,0x40};//正转表格

unsigned char code B_Rotation[4]={0x40,0x20,0x10,0x08};//反转表格

void Delay(unsigned int i)//延时

{

while(--i);

}

main()

{

unsigned char i;

while(1)

{

for(i=0;i

{

P1=F_Rotation[i]; //输出对应的相 可以自行换成反转表格

Delay(500); //改变这个参数可以调整电机转速

}

}

}

栏目热文

文档排行

本站推荐

Copyright © 2018 - 2021 www.yd166.com., All Rights Reserved.