stiphen - 2015-06-06

I have got a peace of code from Googling .. I need help to make this work with ComPort Library

I use D7

var
Dd: Cardinal;
ID,S: String;
begin
PurgeComm(ComPortHandle, 15);
WritePort('80 00 10 11 00 20 00 46 00 09 4D 4F 42 45 58 00');
ReadString := ' ';
Repeat
Form1.ApplicationProcessMessages;
ReadString := ReadString + Port.Read_Com_Str(80);

Until Pos('4D 4F 42 45 58', ReadString) > 0;
Form1.ApplicationProcessMessages;
If ( Pos('A0 00 14 10 00 20 00', ReadString ) = 0 ) Then
Begin
Port.Connected := false;
End
Else
Begin
S := ReadString;
Dd := Pos('A0 00 14 10 00 20 00', S);
Delete(S, 1, Dd + 6);
ID := Copy(S, 1, 4);
End;