function BinToHex(Hex: String): String;
var
i,j: Integer;
Str: String;
begin
Result:= EmptyStr;
for i:= Length(Hex) downto 1 do
if not (Hex[i] in ['0','1']) then
Delete(Hex,i,1);
while Length(Hex) mod 4 <> 0 do
Hex:= '0' + Hex;
while Length(Hex) > 0 do
begin
Str:= Copy(Hex,1,4);
Delete(Hex,1,4);
j:= 0;
for i:= 1 to Length(Str) do
j:= (j * 2) + StrToInt(Str[i]);
Result:= Result + IntToHex(j,1);
end;
end;
procedure TForm1.Button3Click(Sender: TObject);
begin
Edit1.Text:= BinToHex(ACC7.Caption + ACC6.Caption + ACC5.Caption + ACC4.Caption + ACC3.Caption
+ ACC2.Caption + ACC1.Caption + ACC0.Caption);
end;