Home > 类库下载 > C# class library > C# capture ZigBee serial port data code

C# capture ZigBee serial port data code

高洛峰
Release: 2016-10-13 16:25:56
Original
2274 people have browsed it

Find the header of the data and then read the data

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++;  
    } 
}
Copy after login


source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template