当前位置:网站首页>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.
边栏推荐
- JS 函数 this上下文 运行时点语法 圆括号 数组 IIFE 定时器 延时器 self.备份上下文 call apply
- The Sad History of Image Processing Technology
- 拒绝加班,程序员开发的效率工具集
- The final exam first year course
- Unity3D Button mouse hover enter and mouse hover exit button events
- 英特尔软硬优化,赋能东软加速智慧医疗时代到来
- Chapter 9 SVM Practice
- 医疗影像领域AI软件开发流程
- php 网站的多语言设置(IP地址区分国内国外)
- 16、热帖排行
猜你喜欢
Basic learning about Redis related content
Layer 2 broadcast storm (cause + judgment + solution)
8. Unified exception handling (controller notifies @ControllerAdvice global configuration class, @ExceptionHandler handles exceptions uniformly)
完整复制虚拟机原理(云计算)
4、敏感词过滤(前缀树)
CMOS和TTL的区别?
【C语言】进制转换一般方法
STM32CUBEMX开发GD32F303(11)----ADC在DMA模式下扫描多个通道
【Android】Room —— SQLite的替代品
Real-time image acquisition based on FPGA
随机推荐
YOLOV5学习笔记(二)——环境安装+运行+训练
execsnoop 工具
【C语言】表达式求值的一般方法
加密公司向盗窃的黑客提供报价:保留一点,把剩下的归还
Word/Excel fixed table size, when filling in the content, the table does not change with the cell content
YOLOV5 study notes (2) - environment installation + operation + training
First acquaintance with C language -- array
开题报告之论文框架
The difference between link and @import
Mathematics to solve the problem - circular linked list
Discourse Custom Header Links
多线程下类对象的服务承诺探讨
Why is String immutable?
BAT卖不动「医疗云」:医院逃离、山头林立、行有行规
8. Unified exception handling (controller notifies @ControllerAdvice global configuration class, @ExceptionHandler handles exceptions uniformly)
The Sad History of Image Processing Technology
19.支持向量机-优化目标和大间距直观理解
StringJoiner in detail
Brute Force/Adjacency List Breadth First Directed Weighted Graph Undirected Weighted Graph
【C语言】进制转换一般方法