首页 >类库下载 >C#类库 >C#抓取ZigBee串口数据代码

C#抓取ZigBee串口数据代码

高洛峰
高洛峰原创
2016-10-13 16:25:562258浏览

从中找出数据的头,然后读取数据

if (readedDataBuffer.Count >= 20)  
{  
    int removeCount = 0;  
    for (int i = 0; i < readedDataBuffer.Count - 18; ++i)  
    {  
            // 14 7B节点  
            if (readedDataBuffer[i] == 0xFD & readedDataBuffer[i + 4] == 0x28 & readedDataBuffer[i + 5] == 0x7B)  
            {  
                byte[] data = new byte[20];  
   
                /*节点*/  
                int data31, data32;  
                double v3, T3;  
                data31 = readedDataBuffer[i + 12];//高八位  
                data32 = readedDataBuffer[i + 13];//低八位  
                v3 = (data31 * 256 + data32);//电压值  
                T3 = -39.66 + 0.01 * v3 + 0.026;  
                tcure = T3;  
                wendu = T3.ToString();  
        }  
        removeCount++;  
    } 
}


声明:
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn