procedure TbdForm.CPD4ReceiveData(Sender: TObject;
DataPtr: Pointer;
DataSize: Cardinal);
var sa:array[1..2] of byte;
r,rr:real;s1,s2:string;
begin
move(DataPtr^,sa,2);
--读数,硬件发出两个字节数据,高字节在前低字节在后,如果是一个字节 move(DataPtr^,sa,1);
就好了
r:=(sa[1]*256+sa[2])*lcxs-yjlz;
if symodel=3 then
begin
r:=(sa[1]*256+sa[2])*lcxs*1000-yjlz;
label6.Caption :=format('%6.2f',[r*0.00234]);
end;
//if (r<0.1) and (r>-0.1) then
r:=0;
rr:=Compensatedata(r);
if r<10 then
begin
s1:= Format('%6.3f',[r]);
s2:= Format('%6.3f',[rr]);
end;
if r>=10 then
begin
s1:= Format('%6.2f',[r]);
s2:= Format('%6.2f',[rr]);
end;
if r>=100 then
begin
s1:= Format('%6.1f',[r]);
s2:= Format('%6.1f',[rr]);
end;
label4.Caption :=s1;
if (label8.Visible =false) and (ztbc=false) then
label15.Caption :=s2;
end;