{$cfg_webname}
主页 > 电子信息 > 单片机 >

基于51单片机串行通信的Modbus协议实现

来源:wenku7.com  资料编号:WK716843 资料等级:★★★★★ %E8%B5%84%E6%96%99%E7%BC%96%E5%8F%B7%EF%BC%9AWK716843
以下是资料介绍,如需要完整的请充值下载。
1.无需注册登录,支付后按照提示操作即可获取该资料.
2.资料以网页介绍的为准,下载后不会有水印.资料仅供学习参考之用. 帮助
资料介绍

基于51单片机串行通信的Modbus协议实现(任务书,开题报告,论文13000字)
摘  要
Modbus一种工业级的通信协议。该协议由施耐德电气公司在20世纪70年代提出,一经提出便在工业领域得到了很好的应用,直至现在,该协议仍然扮演着其特有的作用,熠熠生辉。Modbus协议主要是用于计算机和可编程控制器件进行通信,其间的媒介可以是公用线路抑或局部线路,该系统由软件和硬件一同组成。直至今天,Modbus协议的应用范围有增无减,工商业、经济、工程、建筑、制造业等诸多领域都可以看得到Modbus协议的影子。现场总线的种类非常繁杂,Modbus现场总线是其中重要的一种,相比于其它而言,Modbus工业网有着其不可替代的优势和特点:1)共享,用户可以免费使用而不用缴纳相关费用;2)可兼容,支持性强,兼容众多电气化接口;3)简单易操作;4)安全性高稳定性强,能够报障信息的安全和稳定。因为Modbus协议的众多鲜明优点,因此其应用非常广泛,在诸多行业都有广泛应用,也得到很多用户的好评。目前该协议主要运用于电子控制器上。除此之外,Modbus协议还具备监控功能,即便是不同厂商,只要其采用了Modbus协议,都可以进行统一的监控,大大提高了整个平台的可运营性。
本次设计基于51单片机系统和Modbus协议,具体利用PC机和KST51单片机开发板来实现,其中利用自己的DELL笔记本作为上位机,KST51开发板作为下位机,采用了USB转RS485接口进行通信,编写基于串口通信和ModBus协议的程序,结果用LCD显示,实现本次设计的任务要求和目标。

关键词:RS485;51单片机;Modbus协议;串行通信
 
Abstract
Modbus An industrial-grade communication protocol. The agreement was made by Schneider Electric in the 1970s and has been well applied in the industrial sector until now, and the agreement is still playing its unique role and shining. Modbus protocol is mainly used for computer and programmable control devices to communicate, during which the medium can be a public line or a local line, the system consists of software and hardware together. Until today, the scope of application of Modbus protocol continues unabated, industry and commerce, economy, engineering, construction, manufacturing and many other areas can see the shadow of Modbus protocol. The field bus is very complicated, Modbus field bus is one of the important one, compared to other terms, Modbus Industrial Network has its irreplaceable advantages and features: 1) sharing, the user can be free to use without paying the relevant costs; 2) compatible, supportive, compatible with a large number of electrification interface; 3) easy to operate; 4) high stability and stability, to report information security and stability. Because of the many distinctive advantages of the Modbus protocol, so its application is very extensive, in many industries have a wide range of applications, but also get a lot of users praise. At present the agreement is mainly used in electronic controller. In addition, the Modbus protocol also has monitoring capabilities, even if different manufacturers, as long as it uses the Modbus protocol, can be unified monitoring, greatly improving the operational capacity of the entire platform.
This design is based on 51 SCM system and Modbus protocol, the specific use of PC and KST51 microcontroller development board to achieve, which use their own DELL notebook as the host computer, KST51 development board as the next bit machine, using the USB to RS485 interface for communication, Based on the serial communication and ModBus protocol procedures, the results with LCD display, to achieve the design of the task requirements and objectives.

Key words:RS485;51 Single Chip Microcomputer; Modbus protocol; Serial Communication
 
目录
第1章 绪论    1
1.1 研究目的及意义    1
1.2 国内外研究现状    1
1.3 本文内容及安排    2
第2章 Modbus协议    3
2.1 Modbus协议的串口    3
2.2 Modbus协议简介    4
2.3 Modbus协议的串行通信栈    5
2.4 Modbus协议下的串行传输模式    6
2.4.1 RTU传输模式    7
2.4.2 ASCII传输模式    8
2.5 Modbus协议下的CRC校验    9
第3章 Modbus协议通信过程的设计及实现    10
3.1 Modbus协议的硬件设计    10
3.1.1 硬件部分的结构    10
3.1.2 USB转RS485接口    10
3.1.3 单片机开发板    11
3.2 Modbus协议的软件设计    13
3.2.1 软件流程框图    13
3.2.2 Modbus协议的CRC校验    14
3.2.3 通信结果的LCD显示    15
3.2.4 main主函数    16
3.3 Modbus协议通信的实现    18
第4章 总结与展望    20
4.1 总结    20
4.2 展望    20
参考文献    21
致  谢    22

推荐资料