当前位置:网站首页>Hongke dry goods | teaches you how to parse floating-point data in MODBUS
Hongke dry goods | teaches you how to parse floating-point data in MODBUS
2022-07-23 19:43:00 【hongke_ iiot】
Preface
Industrial raspberry pie support MODBUS TCP/RTU Communication protocol , therefore , In the use of Modbus Protocol temperature and humidity sensor 、 Electronic balance 、PLC And other devices are widely used . When industrial raspberry pie as MODBUS TCP/RTU Master station time , You can connect at most 30 A slave device , thus it can be seen , Industrial raspberry pie has good scalability .
One 、 challenges
MODBUS Slave station equipment includes 16 Bit integer data , But the application is more 32 Bit floating point data , This is because 32 Bit floating-point data can be controlled more accurately in the communication process , This kind is often used for weight data such as electronic balance 、 Temperature of temperature and humidity sensor / Humidity data 、 Motor speed and other scenarios .
But in this process, we will face the problem of data analysis : The application of floating-point data needs to follow IEE745 Data conversion rules , To realize the conversion and utilization of integer data .
Register can only store 16 Bit data , So floating point data will be split into two data parts , Stored in two adjacent registers , As follows :
1. When reading data , You need to restore the two register data into floating-point data through data analysis ( Pictured 1 As shown in );
2. When writing data , Through data analysis, a floating-point data is divided into two hexadecimals and written into the corresponding registers ( Pictured 2 As shown in ). chart 1. The register data is merged into a floating-point data graph 1. The register data is merged into a floating-point data graph 1. Register data is merged into floating-point data

chart 1. Register data is merged into floating-point data

chart 2. Floating point data is written to register
Two 、 Solution
In response to such problems , Hongke provides an analytical method , As follows :
1、 Read two register data , Combine the two register data into floating-point data through bit operation .



2、 Write a floating point data , Put 32 Bit floating-point data is split into two 16 Bit integer data , Write to two registers respectively .


3、 ... and 、 summary
Industrial raspberry pie uses Debian System , High open source , Can pass C/C++、Java、C#、Python Etc . About converting floating point data into 16 There are many methods that can be used to parse hexadecimal integer data , The above is only one of the data analysis methods , There are errors in this analytical method , The error range is ±0.01, It can be applied to the situation that the precision of floating-point data is not particularly high . For the above scenarios , If there are other parsing methods , Welcome to add engineers to wechat for communication .
Four 、 Project introduction
Hongke industrial raspberry pie products have real-time Raspbian System , built-in Broadco Multi core processors have the ability to process complex tasks such as image processing .

Besides , It's small and flexible , Low power consumption , Support with Python/Java/C/C++/C#、Node-RED Visual programming tools for development , Also can realize CPDESYS soft PLC function , It can help users quickly create applications in scenarios such as data acquisition and small-scale control , Realize industrial Internet of things and digital production .

Learn more about , Welcome private message 、 Bloggers focus on
边栏推荐
- Talk about the parental delegation mechanism in detail (often asked in interviews) [easy to understand]
- Alibaba's latest masterpiece! It took 187 days for the liver to come out. 1015 pages of distributed full stack manuals are so delicious
- AtCoder Regular Contest 144【VP记录】
- Latex(katex)csdn 希腊字母表示,数学符号,集合符号,特殊标记
- Educational codeforces round 132 (rated for Div. 2) [competition record]
- ACM MM 2022 Oral | DIG: 自监督文字识别的新框架,刷新11个公开场景文字数据集的识别性能,平均提升5%...
- 总结一些最近见到的 TRICK
- Mysql database [Database Foundation -- introduction]
- 入门数据库Days3
- Why are there Chinese materials and web pages for foreign chips?
猜你喜欢
![Mysql database [Database Foundation -- introduction]](/img/a9/429beb3a0be7c82084e803e3165d92.png)
Mysql database [Database Foundation -- introduction]

PowerCLi 导入 LicenseKey 到esxi

【开发经验】开发项目踩坑集合【持续更新】

结构体大小的计算(结构体内存对齐)

PowerCLi 管理VMware vCenter 一键批量部署OVA

C语言的查漏补缺(1)

H7-TOOL的CANFD/CAN接口脱机烧写操作说明, 已经更新(2022-07-12)

吃透Chisel语言.21.Chisel时序电路(一)——Chisel寄存器(Register)详解

固态硬盘的工作原理揭秘

Alibaba's latest masterpiece! It took 187 days for the liver to come out. 1015 pages of distributed full stack manuals are so delicious
随机推荐
Safely stop NodeOS
【leetcode天梯】链表 · 206 反转链表
入门数据库Days3
某些题目对应的智慧数据总结
ES6其他语法及扩展语法总结
Talk about the parental delegation mechanism in detail (often asked in interviews) [easy to understand]
idea 选中代码生成方法
Labyrinth DP integration
There is great competition pressure for software testing jobs, and the "migrant workers" who graduated from 985 also suffer
吃透Chisel语言.21.Chisel时序电路(一)——Chisel寄存器(Register)详解
Leetcode daily question (1514. path with maximum probability)
Powercli add esxi host to vCenter
redis过期key的删除策略[通俗易懂]
MySQL中 8 种常见的 SQL 错误用法
Industry analysis | logistics intercom
结构体大小的计算(结构体内存对齐)
入门数据库days1
【luogu P6656】【LOJ 173】【模板】Runs(字符串)(Lyndon 串)
Elk note 25 - expérience rapide APM
H7-TOOL的CANFD/CAN接口脱机烧写操作说明, 已经更新(2022-07-12)