我有一个modbus连接到一个通风系统,在那里它产生警报时,有问题。我可以用modbus接收有关警报的数据。该部分被记录为ID、日期和时间的寄存器。所有tre接收包含2字节的数据。ID 00:13 (转换为十进制错误代码19 =过滤器警报)
但我不知道日期和时间是什么格式。然而,我可以在通风系统中看到这些日期和时间在显示器上被转换为什么。
我收到的日期(十六进制)= 43:68 (小数为17256),在显示上与"13-11-08“(08-2013年11月-2013年)相等,在显示"06:35”上,以字节(十六进制)= 34:71 (小数点13425)为单位。
我试着与"1970和1980“时代进行比较,并尝试与其他时间翻译、32位整数等进行比较。但我不知道翻译是什么。也许这里有人看过模拟,并能分辨出这是什么编码。
向托马斯·尼森问好
发布于 2013-11-28 14:21:37
谢谢纳莫夫,我把它修好了。我“翻译”并提出了这个工作:)它给了我以下08-11-2013 06:35:24,这是我想要的。耽误您时间,实在对不起。
Dim strDate As String = "17256"
Dim year As String = (strDate >> 9) + 1980
Dim month As String = (strDate And &H1E0) >> 5
Dim day As String = strDate And &H1F
Dim strTime As String = "13425"
Dim hour As String = strTime >> 11
Dim minute As String = (strTime And &H7E0) >> 5
Dim secund As String = (strTime And &H1F) * 2
Dim AlarmDate As String = New DateTime(CInt(year), CInt(month), CInt(day), CInt(hour), CInt(minute), CInt(secund))https://stackoverflow.com/questions/20018623
复制相似问题