//spcomm数据发送函数
procedure TForm1.SendHex(S: String); //spcomm发送字符串s
var
s2:string;
buf1:array[0..1000] of char;
i:integer;
begin
s2:='';
for i:=1 to length(s) do //滤去16进制外的字符
begin
if ((copy(s,i,1)>='0') and (copy(s,i,1)<='9'))or((copy(s,i,1)>='a') and (copy(s,i,1)<='f'))
or((copy(s,i,1)>='A') and (copy(s,i,1)<='F')) then
begin
s2:=s2+copy(s,i,1);
end;
end;
for i:=0 to (length(s2) div 2-1) do
buf1[i]:=char(strtoint('$'+copy(s2,i*2+1,2))); //字符串s存入数组并发送
Comm1.WriteCommData(buf1,(length(s2) div 2));
end;
//spcomm数据发送函数
procedure TForm1.SendHex(S: String); //spcomm发送字符串s
var
s2:string;
buf1:array[0..1000] of char;
i:integer;
begin
s2:='';
for i:=1 to length(s) do //滤去16进制外的字符
begin
if ((copy(s,i,1)>='0') and (copy(s,i,1)<='9'))or((copy(s,i,1)>='a') and (copy(s,i,1)<='f'))
or((copy(s,i,1)>='A') and (copy(s,i,1)<='F')) then
begin
s2:=s2+copy(s,i,1);
end;
end;
for i:=0 to (length(s2) div 2-1) do
//spcomm数据发送函数procedure TForm1.SendHex(S: String); //spcomm发送字符串svar s2:string; buf1:array[0..1000] of char; i:integer;begin s2:=''; for i:=1 to length(s) do //滤去16进制外...