procedure TfrmClientMain.SayAddr;
var
sbuf:array[1..7] of byte;
begin
sbuf[1]:=byte($35);
sbuf[2]:=byte($A1); {命令号}
sbuf[3]:=byte($00);
sbuf[4]:=byte($00);
sbuf[5]:=byte($00);
sbuf[6]:=byte($00);
sbuf[7]:=byte($58);
senddata(sbuf);{调用发送函数}
end;
//发送方法
procedure TfrmClientMain.senddata(sbuf:array of byte);
var
i:integer;
commflg:boolean;
viewstring:string;
begin
commflg:=true;
for i:=0 to High(sbuf) do
begin
if not Comm1.writecommdata(@sbuf[i],1) then
begin
commflg:=false;
break;
end;
viewstring:=viewstring+inttohex(sbuf[i],2)+' ';
end;
viewstring:='发送'+viewstring;
memo1.Lines.Add(viewstring);
if not commflg then
messagedlg('发送失败!',mterror,[mbyes],0);
end;