资源简介
很优秀的串口调试助手代码
代码片段和文件信息
using System;
using System.Collections.Generic;
namespace MySSCOM
{
internal class CheckTransportProtocol
{
private uint Checksum
{
get
{
return this.checksum;
}
set
{
this.checksum = value;
}
}
public List ArrByte
{
get
{
return this.arrByte;
}
set
{
this.arrByte = value;
}
}
public CheckTransportProtocol()
{
this.arrByte = new List();
}
private void xorChecksum()
{
if (this.arrByte.Capacity == 0)
{
return;
}
this.Checksum = 0u;
byte b = (byte)(this.arrByte[0] ^ this.arrByte[1]);
for (int i = 2; i < this.arrByte.Count; i++)
{
b ^= this.arrByte[i];
}
this.Checksum = (uint)b;
}
private void sumChecksum()
{
if (this.arrByte.Capacity == 0)
{
return;
}
this.Checksum = 0u;
byte b = 0;
for (int i = 0; i < this.arrByte.Count; i++)
{
b += this.arrByte[i];
}
b = (byte)(256 - (int)b % 256);
this.Checksum = (uint)b;
}
private void crc8Checksum()
{
if (this.arrByte.Capacity == 0)
{
return;
}
this.Checksum = 0u;
byte b = 0;
for (int i = 0; i < this.arrByte.Count; i++)
{
b = this.CRC8Table[(int)(b ^ this.arrByte[i])];
}
this.Checksum = (uint)b;
}
private void crc16Checksum()
{
if (this.arrByte.Capacity == 0)
{
return;
}
this.Checksum = 0u;
byte b = byte.MaxValue;
byte b2 = byte.MaxValue;
for (int i = 0; i < this.arrByte.Count; i++)
{
int num = (int)(b2 ^ this.arrByte[i]);
b2 = (byte)(b ^ this.auchCRCHi[num]);
b = this.auchCRCLo[num];
}
this.Checksum += (uint)b2;
this.Checksum <<= 8;
this.Checksum += (uint)b;
}
public uint calculateChecksum(int checkType)
{
switch (checkType)
{
case 1:
this.Checksum = 0u;
break;
case 2:
this.xorChecksum();
break;
case 3:
this.sumChecksum();
break;
case 4:
相关资源
- WPF开发串口调试助手
- 松下PLC与C#通讯串口调试入门教程.z
- C#串口调试工具源码
- c#编写的串口调试助手
- 基于WPF MVVM框架开发的串口调试助手
- C# 串口和以太网通讯超级调试助手 源
- C# 串口调试助手源代码
- 串口调试助手C#源代码
- C#串口调试助手,收发数据保存在MY
- 网络TCPServer转串口UART源码
- vs2010 c# 串口调试助手
- C#串口调试助手_VS2010()
- Wince6.0+C#串口调试助手源码
- C# 串口调试助手源码(自动搜索PC可用
- Rs232串口调试信息传输(C#)
- C#编写串口调试助手完整项目
- C#简单串口调试助手
- modbus C#串口调试源码功能完善最完美
- C#串口调试工具44664
- C#写的串口调试和校验和软件
- WinCE串口调试助手
- C#版串口调试工具源码vs2010免积分
- C#通过PPI协议操作西门子PLC S7-200的串
- 自己用C#做的串口调试助手,完整源码
- 基于c#、wpf的串口调试助手
- C#WinForm串口调试工具源码2012825
- Serialport 用VS2010编写的串口调试助手
- SerialPort 用C#编写的一个串口调试助手
- CSharp_serial 用C#编的串口调试助手
- COMTools_v2.0 C# 串口调试助手源代码。检
评论
共有 条评论