德
德尔福_qwz
Unregistered / Unconfirmed
GUEST, unregistred user!
procedure TDM.ComPort1RxChar(Sender: TObject; Count: Integer);
Var
RecvData :Array of Byte;
AvalidData :Array of Byte;
CountA:integer;
begin
sleep(60);
CountA:=ComPort1.InputCount;
if CountA <6 then
Exit;
SetLength(RecvData, CountA);
//是什么意思?
ComPort1.Read(RecvData[0], CountA);
//是什么意思?
if ((RecvData[0] <>$FF)or(RecvData[1] <>$00)) then
Exit;
//是什么意思?
SetLength(AvalidData, CountA-2);
//是什么意思?
Move(RecvData[2], AvalidData[0], CountA-2);
//是什么意思?
SpliteFram(AvalidData);
//是什么意思?
end;
end.
Var
RecvData :Array of Byte;
AvalidData :Array of Byte;
CountA:integer;
begin
sleep(60);
CountA:=ComPort1.InputCount;
if CountA <6 then
Exit;
SetLength(RecvData, CountA);
//是什么意思?
ComPort1.Read(RecvData[0], CountA);
//是什么意思?
if ((RecvData[0] <>$FF)or(RecvData[1] <>$00)) then
Exit;
//是什么意思?
SetLength(AvalidData, CountA-2);
//是什么意思?
Move(RecvData[2], AvalidData[0], CountA-2);
//是什么意思?
SpliteFram(AvalidData);
//是什么意思?
end;
end.