請幫忙將以下程式修改為VB程式
#define MODBUS_GENERTOR 0xA001
Unsigned int CRC;
void ModbusCalcCRC(unsigned char* Frame, unsigned char LenFrame)
{
unsigned char CntByte;
unsigned char j;
unsigned char bitVal;
CRC=0xFFFF;
For(CntByte=0;CntByte<LenFrame;CntByte++)
{
CRC^=Frame[CntByte];
for(j=0;j<8;j++)
{
bitVal=CRC & 0x0001;
CRC=CRC>>1;
if(bitVal==1)
CRC^=MODBUS_GENERATOR;
}
}
}
麻煩各位高手幫幫忙. 謝謝!
JASON 2002/7/12
cts_studio@pchome.com.tw
#define MODBUS_GENERTOR 0xA001
Unsigned int CRC;
void ModbusCalcCRC(unsigned char* Frame, unsigned char LenFrame)
{
unsigned char CntByte;
unsigned char j;
unsigned char bitVal;
CRC=0xFFFF;
For(CntByte=0;CntByte<LenFrame;CntByte++)
{
CRC^=Frame[CntByte];
for(j=0;j<8;j++)
{
bitVal=CRC & 0x0001;
CRC=CRC>>1;
if(bitVal==1)
CRC^=MODBUS_GENERATOR;
}
}
}
麻煩各位高手幫幫忙. 謝謝!
JASON 2002/7/12
cts_studio@pchome.com.tw
全站熱搜
留言列表