//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include "Unit1.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button2Click(TObject *Sender)
{
Close();
}
//---------------------------------------------------------------------------
__fastcall TForm1::fun_SerialCRC(uchar *puchMsg, uint usDataLen)
{
uchar uchCRCHi;
uchar uchCRCLo;
uint uIndex ;
uchCRCHi = 0xff;
uchCRCLo = 0xff;
while (usDataLen--)
{
uIndex = uchCRCHi ^ *puchMsg++;
uchCRCHi = uchCRCLo ^ auchCRCHi[uIndex];
uchCRCLo = auchCRCLo[uIndex];
}
return (uchCRCHi << 8 | uchCRCLo);
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button1Click(TObject *Sender)
{
String st1 = Edit1->Text; //这里调试通不过
String st2 = fun_SerialCRC(&st1,12); //这里调试通不过
Edit2->Text = st2;
}
//---------------------------------------------------------------------------