title: How to convert Hex data to Byte in Delphi7
body: <p>I have a problem that is how to convert Hex file to byte in Delphi 7. I have Hex data: $0183, and I want to convert it to byte, but when I convert it to byte the data was change become 131. I want the data keep it 0183 because i want to and this value with another Hex data $0001. I have write the source code as below:</p>
  
  <pre><code>procedure TForm1.dxBarButton9Click(Sender: TObject);
  var
  h: array [1..12]of string;
  EA2: String;
  EA1: word;
  begin
  h[1]:='01';
  h[2]:='83';
  EA2:='$'+copy(h[1],1,2)+copy(h[2],1,2);    
  Edit1.Text:=(EA2);
  EA1:= StrtoInt(EA2);
  EA1:= EA1 and $0001;
  Edit2.Text:=IntToStr(EA1);
  end;
  </code></pre>
  
  <p>My problem is, the data h[1]&amp;h[2] actually the data that I received from serial communication which is hex file. I just wrote it the code in here as that, just to make it simple. And after I got h[1] &amp;h[2], I need to combine this data becomes EA1=0183. Then I want to do "and " operation with $0001(integer). How I can do that?
  I appreciate your help. Thanks a lot.</p>