当前位置:网站首页>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.
边栏推荐
- MPPT solar charge controller data collection - through the gateway acquisition capacity battery SOC battery voltage, wi-fi
- 你们程序员为什么不靠自己的项目谋生?而必须为其他人打工?
- 10. Redis implements likes (Set) and obtains the total number of likes
- TCP/IP四层模型
- 【shell基础】判断目录是否为空
- 字体压缩神器font-spider的使用
- Observer mode (1)
- Mathematical Ideas in AI
- 10 权限介绍
- Installation, start and stop of redis7 under Linux
猜你喜欢

基于opencv实现人脸检测

工程(五)——小目标检测tph-yolov5

直播预告 | KDD2022博士论文奖冠亚军对话

16. Registration Center-consul

4. Sensitive word filtering (prefix tree)

10、Redis实现点赞(Set)和获取总点赞数

1. Non-type template parameters 2. Specialization of templates 3. Explanation of inheritance

How to design the changing system requirements

6. Display comments and replies

STM32CUBEMX develops GD32F303 (11) ---- ADC scans multiple channels in DMA mode
随机推荐
6、显示评论和回复
Detailed explanation of STP election (step + case)
AI在医疗影像设备全流程应用
JS 函数 this上下文 运行时点语法 圆括号 数组 IIFE 定时器 延时器 self.备份上下文 call apply
Brute Force/Adjacency List Breadth First Directed Weighted Graph Undirected Weighted Graph
11、Redis实现关注、取消关注以及关注和粉丝列表
The final exam first year course
execsnoop 工具
华为分布式存储FusionStorage知识点总结【面试篇】
Face detection based on opencv
【HCIP】ISIS
Mathematical Ideas in AI
Difference between CMOS and TTL?
YOLOV5学习笔记(三)——网络模块详解
公司官网建站笔记(六):域名进行公安备案并将备案号显示在网页底部
医疗影像领域AI软件开发流程
Modbus on AT32 MCU
BAT can't sell "Medical Cloud": Hospitals flee, mountains stand, and there are rules
什么是分布式锁?实现分布式锁的三种方式
Clustering index, and what is the difference between a clustering index