›› 2015, Vol. 28 ›› Issue (10): 27-.

• 论文 • 上一篇    下一篇

STM32与上位机Modbus协议的通信方法

刘禹辰,张仁杰,刘虎,刘振   

  1. (上海理工大学 光电信息与计算机工程学院,上海 200093)
  • 出版日期:2015-10-15 发布日期:2015-10-29
  • 作者简介:刘禹辰(1988—),男,硕士研究生。研究方向:信号与信息处理。E-mail:tdcqxpqh@foxmail.com

Communication Between STM32 and Host Computer Based on Modbus Protocol

LIU Yuchen,ZHANG Renjie,LIU Hu,LIU Zhen   

  1. (School of Optical-Electrical and Computer Engineering,University of Shanghai for Science and Technology,Shanghai 200093,China)
  • Online:2015-10-15 Published:2015-10-29

摘要: 由于步进电机控制系统的需要,文中基于Modbus协议,设计了一种PC上位机与STM32下位机之间通信的方法,介绍了STM32的片上外设以及Modbus协议的实现方法,并给出了RS-485通信电路、STM32和上位机的软件设计。通过测试验证了该方法实现了步进电机控制器与PC之间的数据交换,为基于Modbus协议的上、下位机通信系统提供了参考。

关键词: Modbus协议, STM32, 上位机, 通信

Abstract: This article designs a method for communication between PC and the STM32 based on the Modbus protocol for stepper motor control systems.The STM32 peripherals and the implementation of the Modbus protocol are introduced.The RS-485 communication circuit and the software design of the STM32 and the host computer are presented.Experiments show that the stepper motor controller and PC can exchange data by this method successfully.

Key words: Modbus protocol;STM32;host computer;communication

中图分类号: 

  • TN915.04