当前位置:网站首页>Modbus on AT32 MCUs
Modbus on AT32 MCUs
2022-07-31 02:46:00 【Leo_Tanlei】
Modbus on AT32 MCU
Foreword
This application note describes how to port the FreeMODBUS protocol stack to an AT32F43x microcontroller.The source code provided with this document demonstrates an application using Modbus.As a Modbus slave, the microcontroller can be connected to the host computer through RS485 or RS232, and communicate with the Modbus Poll debugging tool (Modbus master).
Note: The code corresponding to this application note is developed based on the V2.x.x Board Support Package (BSP) provided by Arteli. For other versions of BSP, please pay attention to the difference in usage.
Supported models
AT32F435xx
AT32F437xx
AT32F425xx
About Modbus Protocol
The Modbus protocol uses the master-slave communication technology, that is, the master device actively queries and operates the slave device.Generally, the protocol used by the master device is called Modbus Master, and the protocol used by the slave device is called Modbus Slave.Typical master devices include industrial computers and industrial controllers; typical slave devices such as programmable logic controllers (PLCs).MODBUS is an application layer messaging protocol on layer 7 of the OSI model that provides client/server communication between devices connected to different types of buses or networks.Modbus communication physical interface can choose serial port (including RS232, RS485, etc.), or Ethernet port.
The MODBUS protocol defines a simple protocol data unit (PDU) independent of the underlying communication layer.The MODBUS protocol mapping on a particular bus or network can introduce some additional fields on the Application Data Unit (ADU).
When the server responds to the client, it uses the function code field to indicate either a normal (error-free) response or some kind of error (called an abnormal response).Timeouts need to be managed to explicitly wait for a reply that might not come.
About FreeModbus stack
FreeMODBUS is an implementation of the general Modbus protocol stack used in embedded systems.It provides RTU/ASCII transmission mode and TCP protocol support.FreeModbus follows the BSD license, which means that users can use FreeModbus in commercial environments.At present, FreeMODBUS only provides a protocol stack of a Modbus slave node for free.The stack is written in ANSI C and supports multiple variables.This application guide will introduce how to realize the main functions of the Modbus slave node through the FreeMODBUS protocol stack on the AT32F435 microcontroller, and provide the source code based on the AT32F43x_StdPeriph_Lib and the FreeMODBUS protocol stack.For example, combining AT32-Comm-EV Board and AT-START Board can easily and quickly build a Modbus slave node based on RS485.
About Modbus Poll debugging software
Modbus Poll is a Modbus host simulator that supports Modbus RTU, ASCI, and TCP/IP transmission modes.It can assist developers to debug Modbus slave devices, test and simulate the communication of Modbus protocol.Through the multi-document interface interface, multiple Modbus slave devices, data fields, etc. can be monitored at the same time.Each window can simply set the slave device ID, function code, address, length and polling interval.It supports four basic tables of Modbus data model, and supports multiple public function codes of Modbus.In this application guide, Modbus Poll will be downloaded and installed on the PC as a Modbus master, and connected to the AT-START Board (as a Modbus slave) through a USB-to-RS485 module to realize a complete and testable Modbus communication network.
AT32 hardware preparation
The hardware is mainly composed of AT32-Comm-EV Board and AT-START Board.
The peripheral resources used in the demo provided in this application guide include USARTTMR, etc. Users can flexibly configure and modify according to specific needs, and use RS232 or RS485 to realize the connection of the Modbus physical layer
AT-START Board currently provides routines based on AT-START-F435.Modbus communication based on RS232 can be provided.
AT32-Comm-EV Board can provide routine RS485-based Modbus communication support.
The above is a summary of the content, please download the attachment to view the specific implementation details.
边栏推荐
- Brute Force/Adjacency Matrix Breadth First Directed Weighted Graph Undirected Weighted Graph
- Clustering index, and what is the difference between a clustering index
- Mathematics to solve the problem - circular linked list
- Intranet Infiltration - Privilege Escalation
- 7、私信列表
- 【C语言基础】解决C语言error: expected ‘;‘, ‘,‘ or ‘)‘ before ‘&‘ token
- 15. Website Statistics
- 直播预告 | KDD2022博士论文奖冠亚军对话
- How to design the changing system requirements
- 跨专业考研难度大?“上岸”成功率低?这份实用攻略请收下!
猜你喜欢

Discourse Custom Header Links

SQL注入 Less54(限制次数的SQL注入+union注入)

Why is String immutable?

汉源高科8路HDMI综合多业务高清视频光端机8路HDMI视频+8路双向音频+8路485数据+8路E1+32路电话+4路千兆物理隔离网络

The Sad History of Image Processing Technology

完整复制虚拟机原理(云计算)

f.grid_sample

12 磁盘相关命令

Multilingual settings of php website (IP address distinguishes domestic and foreign)

Intel's software and hardware optimization empowers Neusoft to accelerate the arrival of the era of smart medical care
随机推荐
mmdetection trains a model related command
公司官网建站笔记(六):域名进行公安备案并将备案号显示在网页底部
Brute Force/Adjacency Matrix Breadth First Directed Weighted Graph Undirected Weighted Graph
冒泡排序、选择排序、直接插入排序、二分法查找
The difference between link and @import
The use of font compression artifact font-spider
Discussion on Service Commitment of Class Objects under Multithreading
12 磁盘相关命令
Multilingual settings of php website (IP address distinguishes domestic and foreign)
Introduction to flask series 】 【 flask - using SQLAlchemy
Chapter 9 SVM实践
AtCoder Beginner Contest 261 部分题解
8. Unified exception handling (controller notifies @ControllerAdvice global configuration class, @ExceptionHandler handles exceptions uniformly)
跨专业考研难度大?“上岸”成功率低?这份实用攻略请收下!
11、Redis实现关注、取消关注以及关注和粉丝列表
工程(五)——小目标检测tph-yolov5
11. Redis implements follow, unfollow, and follow and follower lists
The principle of complete replication of virtual machines (cloud computing)
Discourse Custom Header Links
完整复制虚拟机原理(云计算)