当前位置:网站首页>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太阳能充放电控制器数据采集-通过网关采集电池电压容量电量SOC,wifi传输

字体压缩神器font-spider的使用

The whole process scheduling, MySQL and Sqoop

Pythagorean tuple od js

Classic linked list OJ strong training problem - fast and slow double pointer efficient solution

JS 函数 this上下文 运行时点语法 圆括号 数组 IIFE 定时器 延时器 self.备份上下文 call apply

全流程调度——MySQL与Sqoop

Word/Excel fixed table size, when filling in the content, the table does not change with the cell content

Chapter 9 SVM实践
随机推荐
Chapter 9 SVM实践
Modbus on AT32 MCU
关于 mysql8.0数据库中主键位id,使用replace插入id为0时,实际id插入后自增导致数据重复插入 的解决方法
11、Redis实现关注、取消关注以及关注和粉丝列表
Intel's software and hardware optimization empowers Neusoft to accelerate the arrival of the era of smart medical care
跨专业考研难度大?“上岸”成功率低?这份实用攻略请收下!
JS 函数 this上下文 运行时点语法 圆括号 数组 IIFE 定时器 延时器 self.备份上下文 call apply
AI中的数学思想
Draw Your Cards
The real CTO is a technical person who understands products
Observer mode (1)
Validate XML documents
StringJoiner in detail
mycat的主从关系 垂直分库 水平分表 以及mycat分片联表查询的配置详解(mysql5.7系列)
coldfusion8 background scheduled tasks take shell
19. Support Vector Machines - Intuitive Understanding of Optimization Objectives and Large Spacing
拒绝加班,程序员开发的效率工具集
Calculate S=a+aa+…+aa…a
16、热帖排行
1. Non-type template parameters 2. Specialization of templates 3. Explanation of inheritance