史
史小青
Unregistered / Unconfirmed
GUEST, unregistred user!
请给以下每一行代码加上详细注解,是每一行详细注解!!!!!!谢谢!procedure TForm1.Timer4Timer(Sender: TObject);
var
st:string[5];
sb:array[1..3]of string[1];
s1,s2:string;
outt:ARRAY[1..200]OF char;
N,I,FCS,FCSH,FCSL:INTEGER;
NACTUALWRITE:INTEGER;
begin
s1:='@00RR04800028';
fcs:=$40;
for i:=2 to LENGTH(S1) do
begin
fcs:=fcs xor integer(s1);
end;
fcsl:=fcs and $0f;
fcsh:=(fcs and $f0) shr 4;
st[1]:=#42;
st[2]:=#13;
sb[1]:=format('%x',[fcsl]);
sb[2]:=format('%x',[fcsh]);
s2:=s1+sb[2]+sb[1]+st[1]+st[2];
for n:=1 to length(s2) do
outt[n]:=s2[n];
writefile(hcomm,outT,LENGTH(S2),nactualwrite,lpol);
setevent(post_event);
end;
var
st:string[5];
sb:array[1..3]of string[1];
s1,s2:string;
outt:ARRAY[1..200]OF char;
N,I,FCS,FCSH,FCSL:INTEGER;
NACTUALWRITE:INTEGER;
begin
s1:='@00RR04800028';
fcs:=$40;
for i:=2 to LENGTH(S1) do
begin
fcs:=fcs xor integer(s1);
end;
fcsl:=fcs and $0f;
fcsh:=(fcs and $f0) shr 4;
st[1]:=#42;
st[2]:=#13;
sb[1]:=format('%x',[fcsl]);
sb[2]:=format('%x',[fcsh]);
s2:=s1+sb[2]+sb[1]+st[1]+st[2];
for n:=1 to length(s2) do
outt[n]:=s2[n];
writefile(hcomm,outT,LENGTH(S2),nactualwrite,lpol);
setevent(post_event);
end;