当前位置:网站首页>Modbus on AT32 MCU
Modbus on AT32 MCU
2022-07-31 02:26:00 【Leo_Tanlei】
Modbus on AT32 MCU
前言
本应用笔记介绍了如何将FreeMODBUS协议栈移植到AT32F43x单片机方法。本文档提供的源代码演示了使用Modbus的应用程序。单片机作为Modbus从机,可通过RS485或RS232与上位机相连,与Modbus Poll调试工具(Modbus主机)进行通讯。
注:本应用笔记对应的代码是基于雅特力提供的V2.x.x 板级支持包(BSP)而开发,对于其他版本BSP,需要注意使用上的区别。
支持型号
AT32F435xx
AT32F437xx
AT32F425xx
关于 Modbus 协议
Modbus协议使用的是主从的通讯技术,即由主设备主动查询和操作从设备。一般将主控设备方所使用的协议称为Modbus Master,从设备方所使用的协议称为Modbus Slave。典型的主设备包括工控机和工业控制器等;典型的从设备如可编程逻辑控制器(PLC)等。MODBUS是OSI模型第7层上的应用层报文传输协议,它在连接至不同类型总线或网络的设备之间提供客户机/服务器通信。Modbus通讯物理接口可以选用串口(包括RS232、RS485等),也可以选择以太网口等。
MODBUS协议定义了一个与基础通信层无关的简单协议数据单元(PDU)。特定总线或网络上的MODBUS协议映射能够在应用数据单元(ADU)上引入一些附加域。
当服务器对客户机响应时,它使用功能码域来指示正常(无差错)响应或者出现某种差错(称为异常响应)。需要管理超时,以便明确地等待可能不会出现的应答。
关于 FreeModbus 协议栈
FreeMODBUS是一个针对通用的Modbus协议栈在嵌入式系统中应用的实现。它提供了RTU/ASCII传输模式及TCP协议支持。FreeModbus遵循BSD许可证,这意味着用户可以将FreeModbus应用于商业环境中。目前FreeMODBUS只免费提供了一个Modbus从机节点的协议栈。该协议栈使用ANSI C编写,并且支持多个变量。本应用指南将介绍如何在AT32F435单片机上,通过FreeMODBUS协议栈实现Modbus从机节点的主要功能,并提供基于AT32F43x_StdPeriph_Lib和FreeMODBUS协议栈的源代码。如结合AT32-Comm-EV Board和AT-START Board可以方便快速的搭建起基于RS485的Modbus从机节点。
关于 Modbus Poll 调试软件
Modbus Poll是一个Modbus主机模拟器,支持Modbus RTU、ASCI、TCP/IP传输模式。它可以协助开发人员调试Modbus从设备,测试和模拟Modbus协议的通信。通过多文档界面接口,可以同时监控多个Modbus从机设备、数据域等。每个窗口可简单地设定从设备ID、功能码、地址、长度和轮询间隔。支持Modbus数据模型的四个基本表格,支持Modbus的多个公共功能码。本应用指南中将下载安装Modbus Poll在PC机上作为Modbus主机,与AT-START Board(作为Modbus从机)通过USB转RS485的模块相连,实现一个完整的、可测试的Modbus通信网络。
AT32 硬件准备
硬件主要由AT32-Comm-EV Board和AT-START Board组成。
本应用指南提供的demo使用到的外设资源有USARTTMR等,用户可根据具体需要灵活配置和修改,使用RS232或RS485来实现Modbus物理层的连接
AT-START Board当前提供例程基于AT-START-F435。可提供基于RS232的Modbus通信。
AT32-Comm-EV Board可提供例程基于RS485的Modbus通信支持。
以上为摘要部分内容,具体实现细节请下载附件查看。
边栏推荐
- AI software development process in medical imaging field
- f.grid_sample
- LeetCode 1161 The largest element in the layer and the LeetCode road of [BFS binary tree] HERODING
- Drools基本介绍,入门案例,基本语法
- FPGA-based vending machine
- Pythagorean tuple od js
- print task sorting js od huawei
- "Cloud native's master, master and vulgar skills" - 2022 National New College Entrance Examination Volume I Composition
- pycharm cannot run after renaming (error: can't open file...No such file or directory)
- leetcode-399: division evaluation
猜你喜欢

uniapp uses 3rd party fonts

What does a software test report contain?

FPGA-based vending machine

Pythagorean tuple od js

Static route analysis (the longest mask matching principle + active and standby routes)

STP选举(步骤+案列)详解

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

Maximum monthly salary of 20K?The average salary is nearly 10,000... What is the experience of working in a Huawei subsidiary?

【Bank Series Phase 1】People's Bank of China

Intranet Infiltration - Privilege Escalation
随机推荐
Basic introduction to ShardingJDBC
Manchester City confuses fans with smart scarf that detects emotions
"Cloud native's master, master and vulgar skills" - 2022 National New College Entrance Examination Volume I Composition
LeetCode 每日一题 2022/7/25-2022/7/31
pycharm cannot run after renaming (error: can't open file...No such file or directory)
Problems that need to be solved by the tcp framework
Maximum area of solar panel od js
tcp框架需要解决的问题
[1154] How to convert string to datetime
英特尔软硬优化,赋能东软加速智慧医疗时代到来
Android's webview cache related knowledge collection
Arbitrum Interview | L2 Summer, what does the standout Arbitrum bring to developers?
Static route analysis (the longest mask matching principle + active and standby routes)
Tower of Hanoi problem
19.支持向量机-优化目标和大间距直观理解
力扣刷题之爬楼梯(7/30)
系统需求多变如何设计
16. Registration Center-consul
Nacos
f.grid_sample