
type
  Str3 = String[3]; 
  Str5 = String[5]; 
  word = integer;

const
  s: array [0..15] of char =
     ('0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F');


  FUNCTION ByteToStr(ByteWert : Byte) : Str3;
  VAR
    decimal : Integer;
    dezi: ARRAY[1..3] OF integer;
    hstring : Str3;
  BEGIN
 
    dezi[1]:=0;
    dezi[2]:=0;
    dezi[3]:=0;

    decimal := ByteWert;
    dezi[3] := decimal DIV 100;
    decimal := decimal MOD 100;
    dezi[2] := decimal DIV 10;
    dezi[1] := decimal MOD 10;
 
    hstring:=s[dezi[3]]+s[dezi[2]]+s[dezi[1]];

    ByteToStr:=hstring;

  END; { FUNCTION ByteToStr }





  FUNCTION WordToStr(WordWert : Word) : Str3;
  VAR
    decimal : Integer;
    dezi: ARRAY[1..3] OF integer;
    hstring : Str3;
  BEGIN
 
    dezi[1]:=0;
    dezi[2]:=0;
    dezi[3]:=0;

    decimal := WordWert;
    dezi[3] := decimal DIV 100;
    decimal := decimal MOD 100;
    dezi[2] := decimal DIV 10;
    dezi[1] := decimal MOD 10;
 
    hstring:=s[dezi[3]]+s[dezi[2]]+s[dezi[1]];

    WordToStr:=hstring;

  END; { FUNCTION WordToStr }




  FUNCTION ByteToHex(HexWert : Byte) : Str3;
  VAR
    decimal : Integer;
    hexa: ARRAY[1..2] OF integer;
    hstring : Str3;
  BEGIN
 
    hexa[1]:=0;
    hexa[2]:=0;

    decimal := HexWert;
    hexa[1] := decimal MOD 16;
    decimal := decimal DIV 16;
    hexa[2] := decimal MOD 16;

    hstring:=s[hexa[2]]+s[hexa[1]]+'H';

    ByteToHex:=hstring;

  END; { FUNCTION ByteToHex }



  FUNCTION WordToHex(HexWert : Integer) : Str5;
  VAR
    decimal : Integer;
    hexa: ARRAY[1..4] OF Integer;
    hstring : Str5;
  BEGIN
 
    hexa[1]:=0;
    hexa[2]:=0;
    hexa[3]:=0;
    hexa[4]:=0;

    decimal := HexWert;
    hexa[1] := decimal MOD 16;
    decimal := decimal DIV 16;
    hexa[2] := decimal MOD 16;
    decimal := decimal DIV 16;
    hexa[3] := decimal MOD 16;
    decimal := decimal DIV 16;
    hexa[4] := decimal MOD 16;

    hstring:=s[hexa[4]]+s[hexa[3]]+s[hexa[2]]+s[hexa[1]]+'H';

    WordToHex:=hstring;

  END; { FUNCTION WordToHex }
















