procedure Tfrm_CheckCloth.cnrs232ReceiveData(Sender: TObject; Buffer: Pointer;
BufferLength: Word);
var
MyRcvData:Array[..] of byte;
ChkStr:string;
tmp : Integer;
begin
move(buffer^,pchar(@MyRcvData)^,);
// ChkStr := inttostr(MyRcvData[]* +MyRcvData[]) + inttostr(MyRcvData[]* +MyRcvData[]);
ChkStr := Format('%0.2x%0.2x%0.2x%0.2x', [MyRcvData[3], MyRcvData[4],MyRcvData[5],MyRcvData[6]]);
try
tmp := strtoint('$'+ChkStr);
except
tmp := ;
end;
GetRS232DateLen :=Format( '%.2f',[(tmp)/]);
end;
烟台一码表厂的码表:
通讯举例:仪表地址假设为1
读取当前显示值(假设当前显示值为1000)
上位机发送(HEX) 01 03 00 14 00 02 84 0F
仪表回应(HEX): 01 03 04 00 00 03 E8 FA 8D
红字表示码表数值。