当前位置:网站首页>基于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
边栏推荐
- 第2章 Pytorch基础1
- 机器学习——朴素贝叶斯
- PyTorch 19. PyTorch中相似操作的区别与联系
- [3D shape reconstruction series] implicit functions in feature space for 3D shape reconstruction and completion
- 直观理解 torch.nn.Unfold
- SSL / TLS application example
- Compression and acceleration technology of deep learning model (I): parameter pruning
- The Cora dataset was trained and tested using the official torch GCN
- 第8章 生成式深度学习
- torch_ Geometric learning 1, messagepassing
猜你喜欢

GIS实战应用案例100篇(五十一)-ArcGIS中根据指定的范围计算nc文件逐时次空间平均值的方法

SHA512/384 原理及C语言实现(附源码)

Summary of image classification white box anti attack technology

【3D形状重建系列】Implicit Functions in Feature Space for 3D Shape Reconstruction and Completion

Mysql database installation and configuration details

【点云系列】Neural Opacity Point Cloud(NOPC)

1.1 pytorch and neural network

Chapter 3 pytoch neural network toolbox

【点云系列】点云隐式表达相关论文概要
Raspberry Pie: two color LED lamp experiment
随机推荐
swin transformer 转 onnx
【动态规划】不同的二叉搜索树
N states of prime number solution
Device Tree 详解
Solution to slow compilation speed of Xcode
The simplest and complete example of libwebsockets
主流 RTOS 评估
【点云系列】Relationship-based Point Cloud Completion
rearrange 和 einsum 真的优雅吗
图像分类白盒对抗攻击技术总结
Systrace 解析
scons 搭建嵌入式arm编译
FATFS FAT32学习小记
The Cora dataset was trained and tested using the official torch GCN
Computer shutdown program
第5 章 机器学习基础
【3D形状重建系列】Implicit Functions in Feature Space for 3D Shape Reconstruction and Completion
Machine learning III: classification prediction based on logistic regression
第8章 生成式深度学习
PyTorch 18. torch.backends.cudnn