1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
| procedure TForm1.ServerSocket1ClientRead(Sender: TObject;
Socket: TCustomWinSocket);
var
data: array[0..26] of byte;
size: byte;
begin
Memo1.Lines.Add('Lecture des informations effectuées');
Size:= Socket.ReceiveLength;
Memo1.Lines.Add('taille='+inttostr(size));
Socket.ReceiveBuf(data,size);
MSB_NUM_IN.text:=inttohex(ord(data[0]),1);
LSB_NUM_IN.text:=inttohex(ord(data[1]),1);
MSB_PRO_IN.text:=inttohex(ord(data[2]),1);
LSB_PRO_IN.text:=inttohex(ord(data[3]),1);
MSB_LG_IN.text:=inttohex(ord(data[4]),1);
LSB_LG_IN.text:=inttohex(ord(data[5]),1);
ADRESSE_IN.text:=inttohex(ord(data[6]),1);
CODE_IN.text:= inttohex(ord(data[7]),1);
DATE.text:='le '+inttostr(data[11])+'/'+inttostr(data[12])+' à '+inttostr(data[8])+'h '+inttostr(data[9])+'min '+inttostr(data[10])+'s';
freq_in.Text:=floattostr(ord(data[13])/2);
U_in.text:=floattostr((256*data[14]+data[15])/2);
I_in.text:=floattostr((256*data[16]+data[17])/10);
P_in.text:=floattostr((256*data[19]+data[20])*10);
gauge1.Progress:=round((256*data[19]+data[20])/15);
end; |
Partager