当前位置:网站首页>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.
边栏推荐
- 221. Largest Square
- 2022牛客多校联赛第四场 题解
- STM32CUBEMX开发GD32F303(11)----ADC在DMA模式下扫描多个通道
- Installation, start and stop of redis7 under Linux
- 关于 mysql8.0数据库中主键位id,使用replace插入id为0时,实际id插入后自增导致数据重复插入 的解决方法
- 软件积累 -- 截图软件ScreenToGif
- Go 项目实战-获取多级分类下的全部商品
- 如何搭建私有yum源
- The comprehensive result of the case statement, do you know it?[Verilog Advanced Tutorial]
- Inter-vlan routing + static routing + NAT (PAT + static NAT) comprehensive experiment
猜你喜欢
英特尔软硬优化,赋能东软加速智慧医疗时代到来
4、敏感词过滤(前缀树)
The principle of complete replication of virtual machines (cloud computing)
MPPT太阳能充放电控制器数据采集-通过网关采集电池电压容量电量SOC,wifi传输
什么是分布式锁?实现分布式锁的三种方式
Multilingual settings of php website (IP address distinguishes domestic and foreign)
General introduction to the Unity interface
SQL注入 Less54(限制次数的SQL注入+union注入)
分布式与集群是什么 ? 区别是什么?
coldfusion8 background scheduled tasks take shell
随机推荐
【银行系列第一期】中国人民银行
15、网站统计数据
Refuse to work overtime, a productivity tool set developed by programmers
Software accumulation -- Screenshot software ScreenToGif
10. Redis implements likes (Set) and obtains the total number of likes
8、统一处理异常(控制器通知@ControllerAdvice全局配置类、@ExceptionHandler统一处理异常)
CentOS7下mysql5.7.37的安装【完美方案】
10 权限介绍
Detailed explanation of STP election (step + case)
工程(五)——小目标检测tph-yolov5
What level of software testing does it take to get a 9K job?
Clustering index, and what is the difference between a clustering index
分布式与集群是什么 ? 区别是什么?
First acquaintance with C language -- array
经典链表OJ强训题——快慢双指针高效解法
Modbus on AT32 MCU
LeetCode Daily Question 2022/7/25-2022/7/31
Multilingual settings of php website (IP address distinguishes domestic and foreign)
2022牛客多校联赛第四场 题解
Hanyuan Hi-Tech 8-channel HDMI integrated multi-service high-definition video optical transceiver 8-channel HDMI video + 8-channel two-way audio + 8-channel 485 data + 8-channel E1 + 32-channel teleph