f1,f2:byte;
begin
f1:=0;
f2:=0;
datacheck:=0;
len:=length(s);
tmpvar:=0;
for i:=1 to len do
begin
datacheck:=ord(datacheck) xor ord(s[i]);
end;
f1:=datacheck and $0f;
f2:=datacheck and $f0;
f2:=f2 shr 4;
result:=inttostr(f2)+inttostr(f1);
end;
// 调用mscomm控件实现plc通信
procedure tform1.handshake_plc;
上一页 [1] [2] [3] [4] [5] [6] 下一页