组态王 modbus协议 驱动 vc++
代码片段和文件信息
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 2148 2009-06-25 11:14 CommHNatomce.h
文件 7335 2009-06-25 11:14 CommHNCheck.cpp
文件 1131 2009-06-25 11:14 CommHNCheck.h
文件 2710 2009-06-25 11:14 CommHNCommHN.cpp
文件 266 2009-06-25 11:14 CommHNCommHN.def
文件 2566 2009-06-25 11:14 CommHNCommHN.h
文件 183296 2009-07-22 15:18 CommHNCommHN.ncb
文件 3183 2009-06-25 11:14 CommHNCommHN.rc
文件 398 2009-06-25 11:14 CommHNCommHN.rc2
文件 1315 2009-06-25 11:14 CommHNCommHN.sln
..A..H. 9728 2009-07-22 15:18 CommHNCommHN.suo
文件 10599 2009-06-25 11:14 CommHNCommHN.vcproj
文件 20338 2009-06-25 11:14 CommHNCommHNPro.cpp
文件 3156 2009-06-25 11:14 CommHNCommHNPro.h
文件 5061 2009-06-25 11:14 CommHNDataType.h
文件 5429 2009-07-22 15:05 CommHNDebugBuildLog.htm
文件 13579 2009-07-22 15:05 CommHNDebugCheck.obj
文件 149 2009-07-02 15:56 CommHNDebugCommHN.des
文件 1667072 2009-07-22 15:05 CommHNDebugCommHN.dll
文件 879 2009-07-22 15:05 CommHNDebugCommHN.exp
文件 4273408 2009-07-22 15:05 CommHNDebugCommHN.ilk
文件 1522 2009-07-22 15:05 CommHNDebugCommHN.lib
文件 13956 2009-07-22 15:05 CommHNDebugCommHN.obj
文件 12517376 2009-07-22 15:05 CommHNDebugCommHN.pch
文件 6073344 2009-07-22 15:05 CommHNDebugCommHN.pdb
文件 10728 2009-07-22 15:05 CommHNDebugCommHN.res
文件 106681 2009-07-22 15:05 CommHNDebugCommHNPro.obj
文件 105937 2009-07-22 15:05 CommHNDebugDebug.obj
文件 97542 2009-07-22 15:05 CommHNDebugDevbase.obj
文件 151604 2009-07-22 15:05 CommHNDebugDevCommHN.obj
............此处省略60个文件信息
/************************************************
Copyright(c) 2006 AsiaControl Company
All rights reserved.
File Name: Check.cpp
Class Name: CCheck
Brief: Check functions class
History:
Date Author Remarks
Aug. 2006 Develop Dep.1
************************************************/
#include “stdafx.h“
#include “Check.h“
#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
CCheck::CCheck()
{
}
CCheck::~CCheck()
{
}
/****************************************************************************
* Name
LRC_Check
* Type
public
* Function
Sum up data in buffer by byte then inverse the result and add 1 to it
* Return Value
one-byte data.
* Parameters
buf
[in] the pointer to data buffer
nLen
[in] the length of data
*****************************************************************************/
BYTE CCheck::LRC_Check(BYTE *buf int nLen)
{
ASSERT(buf != NULL);
if (buf == NULL)
{
return 0;
}
BYTE checknum=0;
for (int i=0;i {
checknum+=buf[i];
}
checknum=~checknum;
checknum+=1;
checknum&=0xff;
return checknum;
}
/****************************************************************************
* Name
Sum_Check
* Type
public
* Function
Sum up data in buffer by byte and get a low 8-bit value of the result
* Return Value
one-byte data.
* Parameters
buf
[in] the pointer to data buffer
nLen
[in] the length of data
*****************************************************************************/
BYTE CCheck::Sum_Check(BYTE *buf int nLen)
{
ASSERT(buf != NULL);
if (buf == NULL)
{
return 0;
}
BYTE checkSum = 0;
for (int i=0; i {
checkSum += (BYTE)buf[i];
}
return checkSum;
}
/****************************************************************************
* Name
Xor_Check
* Type
public
* Function
XOR(exclusive or) data in buffer by byte and get a low 8-bit value of the result
* Return Value
one-byte data.
* Parameters
buf
[in] the pointer to data buffer
nLen
[in] the length of data
*****************************************************************************/
BYTE CCheck::Xor_Check(BYTE *buf int nLen)
{
ASSERT(buf != NULL);
if (buf == NULL)
{
return 0;
}
BYTE checkSum = (BYTE)*buf;
for(int i=1; i {
checkSum ^= (BYTE)buf[i];
}
return checkSum;
}
//2^bitWidth - 1. e.g. widthMask(16) = 0xFFFF.
inline long widthMask(int bitWidth)
{
return (((1L << (bitWidth - 1)) - 1L) << 1) | 1L;
}
//inverse the low itnumbit For example reflect(0x3e233) = 0x3e26
inline long reflect(long value int numBits) {
long temp = value;
for (int i =
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 2148 2009-06-25 11:14 CommHNatomce.h
文件 7335 2009-06-25 11:14 CommHNCheck.cpp
文件 1131 2009-06-25 11:14 CommHNCheck.h
文件 2710 2009-06-25 11:14 CommHNCommHN.cpp
文件 266 2009-06-25 11:14 CommHNCommHN.def
文件 2566 2009-06-25 11:14 CommHNCommHN.h
文件 183296 2009-07-22 15:18 CommHNCommHN.ncb
文件 3183 2009-06-25 11:14 CommHNCommHN.rc
文件 398 2009-06-25 11:14 CommHNCommHN.rc2
文件 1315 2009-06-25 11:14 CommHNCommHN.sln
..A..H. 9728 2009-07-22 15:18 CommHNCommHN.suo
文件 10599 2009-06-25 11:14 CommHNCommHN.vcproj
文件 20338 2009-06-25 11:14 CommHNCommHNPro.cpp
文件 3156 2009-06-25 11:14 CommHNCommHNPro.h
文件 5061 2009-06-25 11:14 CommHNDataType.h
文件 5429 2009-07-22 15:05 CommHNDebugBuildLog.htm
文件 13579 2009-07-22 15:05 CommHNDebugCheck.obj
文件 149 2009-07-02 15:56 CommHNDebugCommHN.des
文件 1667072 2009-07-22 15:05 CommHNDebugCommHN.dll
文件 879 2009-07-22 15:05 CommHNDebugCommHN.exp
文件 4273408 2009-07-22 15:05 CommHNDebugCommHN.ilk
文件 1522 2009-07-22 15:05 CommHNDebugCommHN.lib
文件 13956 2009-07-22 15:05 CommHNDebugCommHN.obj
文件 12517376 2009-07-22 15:05 CommHNDebugCommHN.pch
文件 6073344 2009-07-22 15:05 CommHNDebugCommHN.pdb
文件 10728 2009-07-22 15:05 CommHNDebugCommHN.res
文件 106681 2009-07-22 15:05 CommHNDebugCommHNPro.obj
文件 105937 2009-07-22 15:05 CommHNDebugDebug.obj
文件 97542 2009-07-22 15:05 CommHNDebugDevba
文件 151604 2009-07-22 15:05 CommHNDebugDevCommHN.obj
............此处省略60个文件信息
版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件举报,一经查实,本站将立刻删除。
评论列表(条)