keller PAA-3XX/80794系列(绝压)压力传感器
- keller英文版通讯协议百度网盘:提取码:fusc
广播模式:所有从机都会收到上位机信息
Broadcasting This mode of communication enables the master to transmit a message to all slaves
simultaneously. The master does not receive a reply, however, and is thus unable to check
whether the message has been correctly received by every slave.只有单一从机收到:
Data interchange This mode of communication enables the master to communicate with a single slave. This
normally involves the transmission of two messages: the master transmits a request and
the slave responds to this request. Only the master is permitted to request a response. The
request is received by every slave, but only the selected slave responds. The response
must be received within a stipulated time, otherwise the master will assess the attempt as
failed and must transmit the request again.如下数据格式:
The data are transmitted serially via the bus. The following format applies:
1 start bit
8 data bits (the least significant bit first)
1 stop bit
The parity bit can be set for devices of Class.Group = 5.20
9600 baud or 115’200 Baud (only with devices of Class.GrouThis results in 10 bits (11 bits with active parity bit) per transmission byte.
- 命令字符串格式:
Note on the presentation of messages: Each box presents 1 data byte consisting of 8 bits, unless otherwise stated.
Each message sent by the master possesses the following format:
| 设备地址 | 方法代码 | 方法参数 | CRC校验 高位 | CRC校验 低位 |
|---|---|---|---|---|
| DevAddr | 0 Function code | n byte parameters (optional) | CRC16_H | CRC16_L |
| FA | 49 | 01 | A1 | A7 |
· DevAddr: Address of the device.
Address 0 is reserved for broadcasting.
Addresses 1...249 can be used for bus mode.
Address 250 is transparent and reserved for non-bus mode. Every device can be contacted with this address.
Addresses 251...255 are reserved for subsequent developments.
· Function code: Function number
A function is selected and executed by the device via the function number. The function number is encoded in 7 bits. Bit 7 is
always 0. The functions are described further below.
· Parameters:
The parameters required by the function (n = 0 .. 6, according to function)
· CRC16: 16-bit checksum
These two check bytes serve to verify the integrity of the received data. If an error is established, the entire message will be
discarded. The principle employed for CRC16 calculation is described in the appendix. The CRC16 standard is applied here.
Note: The length of a message from the master is at least 4 bytes.
每一个方法参数有 0-6 可选,类似modbus协议
Function:48 (16进制为:30)
F48: Initialise devices, whereby the device ID is returned
命令:FA 30 04 43
| 设备地址 | 方法代码 | 方法参数 | CRC校验 高位 | CRC校验 低位 |
|---|---|---|---|---|
| FA | 30 | 04 | 43 |
Function:73 (16进制为:49)
F73: Read out current pressure and temperature values in floating-point format
命令:FA 49 01 A1 A7
(还有其他方法根据自己所需数据自己去协议找)
| 设备地址 | 方法代码 | 方法参数 | CRC校验 高位 | CRC校验 低位 |
|---|---|---|---|---|
| FA | 49 | 01 | A1 | A7 |
返回数据格式为:

| 设备地址 | 方法代码 | 方法参数 | CRC校验 高位 | CRC校验 低位 |
|---|---|---|---|---|
| FA | 49 | 01 | A1 | A7 |
| 方法代码 | 16进制形式 | 功能描述(英文) | 功能描述(中文) |
|---|---|---|---|
| F3 | Read out the current pressure and temperature values in MODBUS format | ||
| F30 | 1e | Read out scaling values | 读取最大值 |
| F31 | 1f | Write scaling values | |
| F32 | 20 | Read out configurations | 读取配置 |
| F33 | 21 | Write cinfigurations | 写入配置 |
| F48 | 30 | Initialise devices, whereby the device ID is returned | 初始化设备,返回设备ID,询问链接 |
| F66 | 42 | Programm bus address | 总线地址 |
| F69 | 45 | Read out serial number | |
| F73 | 49 | Read out current pressure and temperature values in floating-point format | 读取当前浮点型压力、温度数据 |
| F74 | 4a | Read out current pressure and temperature values in integer format | 读取当前压力温度整形数据 |
| F95 | 5f | Zeroing functions | 归零 |
| F100 | 64 | Read out configurations | 读取配置 |
| F101 | 65 | Write configurations | 写入配置 |
- 返回数据格式:

其中 B3、B2、B1、B0 一个八个十六进制字符,48 = 32 位,按照IEEE754规则表示的浮点数
其中第0位符号位S:1-9 一共8位(bytes)阶码E 9-32 一共23位表示尾数M 小数位 如:0.xxxxxx
整数位默认省略1,所以最后计算需要(-1)S(1+M)*2E-127
遵循IEEE754 浮点数定义:
IEEE754转化浮点数
- python 现成代码:楼主自己项目里面使用的
def parsePressure(pressure):
"""
压力数据格式为:FA 49 B3 B2 B1 B0 STAT CRC16_H CRC16_L
FA 49 3F 81 61 ee 00 11 6f
解析返回压力,统一返回千帕-kpa,保留7位小数
0:KPA | 1: MPA | 3 PA | 5 bar
:param pressure:
:return:
"""
UNIT = {
"KPa": 1,
"MPa": 1000,
"Pa": 0.001,
"Bar": 100
}
pressure16 = pressure[4:12]
binAll = str(bin(int(pressure16, 16)))[2:]
# binAll = binAll[2:]
data = [x for x in binAll[:-24:-1]]
data.reverse()
binE = binAll[:-23]
E = int(binE, 2) - 127
total = 1
for i, v in enumerate(data):
total = total + int(v) * (2 ** -(i + 1))
pressure = total*(2**E)
return pressure*UNIT["Bar"]
SeriaPort 类为继承serial 模块复写write/read 方法,(pip install pyserial)
from Lib.SerialPort import *
import time
import os
import threading
import binascii
import re
class PressureSensor(object):
"""
压力传感器型号为:keller PAA-3XX/80794(绝压)
协议类型: KELLER protoco (类MODBUS 协议)
Each message sent by the master possesses the following format:
DevAddr | 0 Function code | n byte parameters (optional) |CRC16_H CRC16_L
"""
def __init__(self,com='COM14' ):
self.seria = SerialPort(com,9600)
self.last_str = "FA493F8161ee00116f"
print('PressureSensor初始化成功')
def readPressure(self):
self.seria.Write(bytes.fromhex("FA 49 01 A1 A7"))
pressurestr = str(binascii.b2a_hex(self.seria.Read()).decode())
self.last_str = pressurestr if pressurestr != '' else self.last_str
return self.parsePressure(self.last_str)
def parsePressure(self, pressure):
"""
压力数据格式为:FA 49 B3 B2 B1 B0 STAT CRC16_H CRC16_L
FA 49 3F 81 61 ee 00 11 6f
解析返回压力,统一返回千帕-kpa,保留7位小数
0:KPA | 1: MPA | 3 PA | 5 bar
:param pressure:
:return:
"""
UNIT = {
"KPa": 1,
"MPa": 1000,
"Pa": 0.001,
"Bar": 100
}
pressure16 = pressure[4:12]
binAll = str(bin(int(pressure16, 16)))[2:]
# binAll = binAll[2:]
data = [x for x in binAll[:-24:-1]]
data.reverse()
binE = binAll[:-23]
E = int(binE, 2) - 127
total = 1
for i, v in enumerate(data):
total = total + int(v) * (2 ** -(i + 1))
pressure = total*(2**E)
return pressure*UNIT["Bar"]



keller PAA-3XX/80794系列(绝压)压力传感器的更多相关文章
- 快速入门系列--JMeter压测工具
今天的年会已过,仍然是空手而归,不过俺坚信能让生活稳定永远都是努力.由于隔壁组负责年会的抢红包项目,因而趁此机会把通过工具模拟高并发的知识补了补,通过和身边大师的交流,总算是对压力测试有了个简要的了解 ...
- BA-siemens-symaro传感器简介
1 传感器的原理 传感器.控制器.执行机构是构成控制系统 3 个要素,传感器的作 用一般用来测量工艺参数,提供给控制器或显示仪表,实现工艺过程的 监测或控制.传感器的类型是按测量参数不同分类的,主要分 ...
- pixhawk入门知识
Pixhawk是一种先进的自动驾驶仪,由PX4开放硬件项目设计和3D机器人制造.它具有来自ST公司先进的处理器和传感器技术,以及NuttX实时操作系统,能够实现惊人的性能,灵活性和可靠性控制任何自主飞 ...
- HTTP常见返回代码(HTTP Status codes)的分类和含义
HTTP错误主要分成三类:用户设备问题.Web服务器问题和连接问题.当客户端向Web服务器发送一个HTTP请求时,服务器都会返回一个响应代码.而这些响应代码主要分成五类. HTTP状态码中定义了5大类 ...
- 最近买了个Mac Pro,用起来感觉是去年买了个表
最近买了个 Mac Pro ,用了两个星期,强烈建议大家不要买 Mac Pro (128G)搞开发,反而建议用同样的价格,我买的是最便宜8千的,去买个带固态硬盘的联想X系列绝对比Pro好. 一.操作方 ...
- Intel发6款全新9代i9/i7/i5 CPU:巅峰8核
在旧金山举办的GDC19活动中,Intel正式发布9代酷睿新品,面向移动平台的H系列标压处理器,定于今年第二季度上市. 换言之,最快4月份我们就能见到搭载后缀H的9代酷睿CPU笔记本(游戏本)等发售了 ...
- Hacklab WebIDE在线调试ESP32笔记
目录 1.什么是Hacklab WebIDE 1.1 优势 1.2 趋势 2. 使用方法 2.1 功能介绍 2.2 编译第一个程序 2.3 搭建esp32的开发环境 2.4 建立开发板与云平台的连接 ...
- HDU 4539郑厂长系列故事――排兵布阵(状压DP)
HDU 4539 郑厂长系列故事――排兵布阵 基础的状压DP,首先记录先每一行可取的所哟状态(一行里互不冲突的大概160个状态), 直接套了一个4重循环居然没超时我就呵呵了 //#pragma co ...
- linux驱动系列之文件压缩解压小节(转)
转至网页:http://www.jb51.net/LINUXjishu/43356.html Linux下最常用的打包程序就是tar了,使用tar程序打出来的包我们常称为tar包,tar包文件的命令通 ...
随机推荐
- Docker 一步搞定 ZooKeeper 集群的搭建
Docker 一步搞定 ZooKeeper 集群的搭建 背景 原来学习 ZK 时, 我是在本地搭建的伪集群, 虽然说使用起来没有什么问题, 但是总感觉部署起来有点麻烦. 刚好我发现了 ZK 已经有了 ...
- element-ui时间选择器--设置禁止选择的时间
场景需求:开始日期不能小于今天,在今天之前的日期禁止选择,结束日期不能小于开始日期,开始日期之前的日期禁止选择. 效果图: element-ui的时间选择器中,有一个picker-options的属性 ...
- Springboot Actuator之五:Springboot中的HealthAggregator、新增自定义Status
springboot的actuator内置了/health的endpoint,很方便地规范了每个服务的健康状况的api,而且HealthIndicator可以自己去扩展,增加相关依赖服务的健康状态,非 ...
- 面试题(Python)
面试题 字符串反向输出 s = "给阿姨倒杯卡布奇诺"反向输出S:print(s[::-1]) 面试必问:赋值,浅拷贝,深拷贝 赋值:多个变量指到相同内存浅拷贝中所有的元素,不管第 ...
- 乘法器——Wallace树型乘法器
博主最近在看乘法器相关的知识,发现现在用的比较多的是booth编码的乘法器和Wallace树型乘法器,当然两者并不是互斥的关系,他们也可以结合使用.在这里给大家介绍一下Wallace树型乘法器,希望能 ...
- 用ab每隔30分钟并发一次休息10分钟
linux脚本监控程序运行情况(重启程序)主要有两种情况:一种是一个可执行文件:如shell脚本文件:另一种是使用python打开的多个程序.第一种:它的进程名字由路径名字和程序名字组成,比如:我有个 ...
- 【题解】Luogu P5319 [BJOI2019]奥术神杖
原题传送门 题目让我们最大化\(val=\sqrt[k]{\prod_{i=1}^k w_i}\),其中\(k\)是咒语的个数,\(w_i\)是第\(i\)个咒语的神力 看着根号和累乘不爽,我们两边同 ...
- 使用DbVisualizer 10.0.20 查询ES中的索引时需要注意的事项
查询前5条数据 光标停在某一个查询结果框中,左下角会显示该字段的类型 查询类型是text的字段使用单引号,使用双引号查询会报错
- Xgboost GPU配置
眼残cmake版本配错了搞了半天,简单记录一下,老规矩,参考一下官方的文档. git clone --recursive https://github.com/dmlc/xgboost cd xgbo ...
- 计算标准差——Python
计算标准差 题目描述: 编写一个函数计算一系列数的标准差. ...