当前位置:网站首页>基于Labview上位机的51单片机步进电机控制系统(上位机代码+下位机源码+ad原理图+51完整开发环境)
基于Labview上位机的51单片机步进电机控制系统(上位机代码+下位机源码+ad原理图+51完整开发环境)
2022-04-23 06:14:00 【锦官城外w】
功能说明:
1.步进电机运行状态通过VISA串口实时传输至上位机,上位机以曲线显示,并可存储数据。
2.上位机可发送步进电机运行角度、速度指令至下位机,控制步进电机。
3.按键控制电机正反转以及调速。
4.labview可以excel或txt格式存储电机运行数据,并读取复现运行曲线(数据回放功能)。
注意事项:
下位机处理器:STC89C51/STC89C52
上位机:Labview2018+VISA串口
按键控制步进电机
相关引脚连线中文注释:
#include<reg52.h>
#include <intrins.h>
#define uchar unsigned char
#define uint unsigned int
#define MotorData P0 //步进电机控制接口定义
uchar phasecw[4] ={
0x08,0x04,0x02,0x01};//正转 电机导通相序 D-C-B-A
uchar phaseccw[4]={
0x01,0x02,0x04,0x08};//反转 电机导通相序 A-B-C-D
uchar motor_state=0; //0 停 1正转 2反转
uchar motor_speed=5; //5-25 快-慢
sbit key1=P1^1; //正转按键
sbit key2=P1^2; //反转按键
sbit key3=P1^0; //调速按键
主函数程序:
void
main(void)
{
Delay_xms(50); //等待系统稳定
Timer_Init(); //初始化定时器
while(1)
{
key_scan(); //扫描按键
if(motor_state==0) MotorStop(); //停止转动
else if(motor_state==1)MotorCW(motor_speed); //顺时针转动角度
else if(motor_state==2)MotorCCW(motor_speed);//逆时针转动角度
}
}
包含资料如下所示:

上位机运行截图:

全部资料链接见评论区,有问题请留言~
作者:amusen
时间:2022.4
祝好!
版权声明
本文为[锦官城外w]所创,转载请带上原文链接,感谢
https://blog.csdn.net/qq_41740659/article/details/124329331
边栏推荐
猜你喜欢

ArcGIS license server administrator cannot start the workaround

图像分类白盒对抗攻击技术总结

Mysql database installation and configuration details

AUTOSAR从入门到精通100讲(五十二)-诊断和通信管理功能单元

Write a wechat double open gadget to your girlfriend

Chapter 1 numpy Foundation

Machine learning notes 1: learning ideas

Chapter 5 fundamentals of machine learning

PyMySQL连接数据库

机器学习——PCA与LDA
随机推荐
Common regular expressions
SHA512/384 原理及C语言实现(附源码)
“Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated
5种方法获取Torch网络模型参数量计算量等信息
第5 章 机器学习基础
Modifying a column with the 'identity' pattern is not supported
Wechat applet uses wxml2canvas plug-in to generate some problem records of pictures
SSL / TLS application example
Gee configuring local development environment
EasyUI combobox determines whether the input item exists in the drop-down list
PyTorch 9. 优化器
SPI NAND FLASH小结
PyTorch 20. PyTorch技巧(持续更新)
【动态规划】不同路径2
Thanos. SH kill bully script, easily delete half of the files in the system at random
PyTorch 22. PyTorch常用代码段合集
PyTorch 13. 嵌套函数和闭包(狗头)
Minesweeping games
Use originpro express for free
PyTorch 14. module类