From: nospam@tiscali.nl   
      
   Hi,   
      
    wrote in message   
   news:1152974554.276213.212260@m79g2000cwm.googlegroups.com...   
   > Greetings.   
   > I am trying to read a real value( 32 bits ) that has the data format in   
   > pascal.   
   >   
      
   I guess you need something like this:   
      
   Function MakeSingle( b1, b2, b3, b4 : Byte ) : Single;   
   type   
    s = record   
    case Byte of   
    0: ( sa : array [1..4] of Byte );   
    1: ( res : Single );   
    end;   
   var   
    u : s;   
   begin   
    u.sa[1] := b1;   
    u.sa[2] := b2;   
    u.sa[3] := b3;   
    u.sa[4] := b4;   
    Result := u.res;   
   end;   
      
   The structure is called a Variant (In C it would be called a union). This   
   allows you to access the same memory positions either as a string or as   
   another type, in this case a single precision float. Another way of doing   
   this would be with pointers, dereferencing into another type.   
   I haven't tried your values. The order of the bytes could be reversed,   
   depending on the microprocessor of the instrument. I know Motorola   
   microprocessors reverse them.   
      
   HTH, Matt   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   
|