当前位置:网站首页>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
边栏推荐
- 单调队列优化DP
- R语言data.table包进行数据分组聚合统计变换(Aggregating transforms)、计算dataframe数据的分组最小值(min)
- 移动语义和完美转发浅析
- Alibaba's latest masterpiece! It took 187 days for the liver to come out. 1015 pages of distributed full stack manuals are so delicious
- FormatDateTime的用法
- .Net CLR R2R编译的原理简析
- How can mysqldump export content without comments?
- Codeforces Round #805-#808【部分题解】
- ACM MM 2022 Oral | DIG: 自监督文字识别的新框架,刷新11个公开场景文字数据集的识别性能,平均提升5%...
- Brief analysis of compiling principle of.Net CLR R2R
猜你喜欢

Still using xshell? You are out. I recommend a more modern terminal connection tool

树莓派ssh登录

DHCP:在网络中防止 Rogue DHCP Server

Why are there Chinese materials and web pages for foreign chips?

J9数字论:数字行业的FOMO现象我们应该怎么克服?

入门数据库Days3

ACM MM 2022 Oral | DIG: 自监督文字识别的新框架,刷新11个公开场景文字数据集的识别性能,平均提升5%...

Data link layer -------- Ethernet and ARP

LeetCode刷题:回文数

Basic process of process scheduling
随机推荐
行业分析| 物流对讲
移动语义和完美转发浅析
AtCoder Regular Contest 144【VP记录】
微信小程序自己实现一个全局事件总线
When does MySQL use table locks and row locks?
Analyse de l'industrie | interphone logistique
树莓派3b串口登录前准备工作
Leetcode daily question (1514. path with maximum probability)
二叉树高度 [log2n]+1与log2(n+1)是否相等
Codeforces Round #805-#808【部分题解】
单调队列优化DP
Powercli moves virtual machines from host01 host to host02 host
在Hyper-V中手动将.avhd合并到.vhd
MySQL中 8 种常见的 SQL 错误用法
离线数据、实时数据是什么
Why are there Chinese materials and web pages for foreign chips?
Type-C Bluetooth speaker single C-Port rechargeable OTG solution
[C language] program environment and preprocessing
LeetCode每日一题(1514. Path with Maximum Probability)
Mysql主从复制