资源简介
此工具是C#语言编写的串口工具源码。比较适合初学者用来熟悉串口

代码片段和文件信息
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.InteropServices;
using System.IO.Ports;
namespace Serialport1
{
///
/// 数据校验类
///
public class CheckEx
{
#region 获取校验码
///
/// 获取和校验
///
///
///
public static byte GetCheckSum(byte[] buf)
{
return GetCheckSum(buf 0);
}
///
/// 获取和校验
///
///
///
///
public static byte GetCheckSum(byte[] buf int offset)
{
return GetCheckSum(buf offset buf != null ? buf.Length - offset : 0);
}
///
/// 获取和校验
///
///
///
///
public static byte GetCheckSum(byte[] buf int offset int count)
{
ulong nSum = 0;
for (int i = offset; i < offset + count; i++)
{
nSum += (uint)buf[i];
}
return (byte)((nSum % 256) & 0xFF);
}
///
/// 获取双字节和校验
///
///
///
public static ushort GetCheckDSum(byte[] buf)
{
return GetCheckDSum(buf 0);
}
///
/// 获取双字节和校验
///
///
///
///
public static ushort GetCheckDSum(byte[] buf int offset)
{
return GetCheckDSum(buf offset buf != null ? buf.Length - offset : 0);
}
///
/// 获取双字节和校验
///
///
///
///
public static ushort GetCheckDSum(byte[] buf int offset int count)
{
ulong nSum = 0;
for (int i = offset; i < offset + count; i++)
{
nSum += (uint)buf[i];
}
return (ushort)((nSum % 65536) & 0xFFFF);
}
///
/// 获取CRC16校验
///
///
///
public static ushort GetCRC16(byte[] buf)
{
return GetCRC16(buf 0);
}
///
/// 获取CRC16校验
///
///
///
///
public static ushort GetCRC16(b
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2018-02-08 09:27 Serialport1\
目录 0 2018-02-08 09:27 Serialport1\.vs\
目录 0 2018-02-08 09:27 Serialport1\.vs\Serialport1\
目录 0 2018-02-08 09:27 Serialport1\.vs\Serialport1\v15\
文件 78336 2018-03-02 20:09 Serialport1\.vs\Serialport1\v15\.suo
目录 0 2018-02-08 09:27 Serialport1\.vs\Serialport1\v15\Server\
目录 0 2018-03-02 20:09 Serialport1\.vs\Serialport1\v15\Server\sqlite3\
文件 0 2017-12-08 11:29 Serialport1\.vs\Serialport1\v15\Server\sqlite3\db.lock
文件 606208 2018-03-01 16:00 Serialport1\.vs\Serialport1\v15\Server\sqlite3\storage.ide
文件 570 2017-03-10 17:58 Serialport1\Config.xm
目录 0 2018-02-08 09:27 Serialport1\Serialport1\
文件 875 2017-07-20 11:44 Serialport1\Serialport1.sln
文件 34816 2017-07-20 11:43 Serialport1\Serialport1.suo
文件 73728 2018-04-17 15:52 Serialport1\Serialport1.v11.suo
目录 0 2018-02-08 09:27 Serialport1\Serialport1\bin\
目录 0 2018-02-08 09:27 Serialport1\Serialport1\bin\Debug\
目录 0 2018-02-08 09:27 Serialport1\Serialport1\bin\Debug\app.publish\
文件 53760 2017-12-28 17:01 Serialport1\Serialport1\bin\Debug\app.publish\Serialport1.exe
文件 115744 2018-04-14 21:16 Serialport1\Serialport1\bin\Debug\Config.xm
文件 2142208 2013-11-28 16:53 Serialport1\Serialport1\bin\Debug\SerialDebug.exe
文件 1904 2017-12-28 17:01 Serialport1\Serialport1\bin\Debug\Serialport1.application
文件 53760 2017-12-28 17:01 Serialport1\Serialport1\bin\Debug\Serialport1.exe
文件 3464 2017-12-28 17:01 Serialport1\Serialport1\bin\Debug\Serialport1.exe.manifest
文件 83456 2017-12-28 17:01 Serialport1\Serialport1\bin\Debug\Serialport1.pdb
文件 1904 2017-12-28 17:01 Serialport1\Serialport1\bin\Debug\Serialport1.vshost.application
文件 22984 2018-04-17 15:51 Serialport1\Serialport1\bin\Debug\Serialport1.vshost.exe
文件 3464 2017-12-28 17:01 Serialport1\Serialport1\bin\Debug\Serialport1.vshost.exe.manifest
目录 0 2017-03-10 18:04 Serialport1\Serialport1\bin\Release\
文件 570 2017-03-13 14:18 Serialport1\Serialport1\Config.xm
文件 17127 2017-03-13 16:11 Serialport1\Serialport1\DataType.cs
文件 3262 2017-03-14 11:41 Serialport1\Serialport1\Logo.ico
............此处省略40个文件信息
- 上一篇:基于asp.net的学生信息管理系统
- 下一篇:C# 聊天室
相关资源
- C#百度地图源码
- Visual C#.2010从入门到精通配套源程序
- C# 软件版本更新
- C#屏幕软键盘源码,可以自己定制界面
- 智慧城市 智能家居 C# 源代码
- c#获取mobile手机的IMEI和IMSI
- C#实现简单QQ聊天程序
- 操作系统 模拟的 欢迎下载 C#版
- C#写的计算机性能监控程序
- 用C#实现邮件发送,有点类似于outlo
- MVC model层代码生成器 C#
- c#小型图书销售系统
- C# Socket Server Client 通讯应用 完整的服
- c# winform 自动登录 百度账户 源代码
- C#编写的16进制计算器
- C#TCP通信协议
- C# 数据表(Dataset)操作 合并 查询一
- C#语音识别系统speechsdk51,SpeechSDK51L
- 数据库备份还原工具1.0 C# 源码
-
[免费]xm
lDocument 节点遍历C# - EQ2008LEDc#开发实例
- DirectX.Capturec# winform 操作摄像头录像附
- c# 实现的最大最小距离方法对鸢尾花
- C#版保龄球记分代码
- C#自定义控件
- 基于c#的实验室设备管理系统621530
- C# 使用ListView控件实现图片浏览器(源
- C#简单窗体聊天程序
- C#指纹识别系统程序 报告
- c# 高校档案信息管理系统
评论
共有 条评论