lucasneves Posted October 4, 2008 Report Share Posted October 4, 2008 Hi everybody, I've started today in take offsets from FSUIPC and send them to Delphi. For study, I am using the Delphi example of the SDK and trying to implement another offsets. During tests with the IAS (offset 02BC), I am not being able to return the correct value of this offset. Comparing with FsInterrogator, my value is very diferent to the value in Fsint. I am sending the routine that calculates the Airspeed in my program. If somebody can tell me what am I doing wrong, i'll be aprreciate. I believe I am not using some other convertion or taking the value in a wrong way. Here is the code: =========================================== procedure TFrmTPrincipal.MostraVelocidade; var dwResult : DWORD; Velocidade: Byte; Calculo: Double; begin if FSUIPC_Read($02BC, 4, @Velocidade, dwResult) then begin if FSUIPC_Process(dwResult) then begin Calculo := Round(Velocidade / 128); stVelocidade.Caption := FloatToStr(Calculo); end; end; end; ============================================================ Thanks very much! Link to comment Share on other sites More sharing options...
Pete Dowson Posted October 4, 2008 Report Share Posted October 4, 2008 During tests with the IAS (offset 02BC), I am not being able to return the correct value of this offset. Comparing with FsInterrogator, my value is very diferent to the value in Fsint. I don't know Delphi, but this looks wrong: Velocidade: Byte; Considering the value you are reading is a 32-bit integer (occupying 4 bytes), don't you think one byte (8 bits) is a bit small? You do seem to know it's 4 bytes long because you have that in the Read: if FSUIPC_Read($02BC, 4, @Velocidade, dwResult) then Regards Pete Link to comment Share on other sites More sharing options...
lucasneves Posted October 5, 2008 Author Report Share Posted October 5, 2008 Dear Pete, At first, thanks for answering me. Do you have some example in C / C++ or another language taking this offset? I can try to write it to delphi. Thanks again. UPDATE: I tried to take the value using a LongInt type variable and it worked! Thanks! Link to comment Share on other sites More sharing options...
Pete Dowson Posted October 5, 2008 Report Share Posted October 5, 2008 I tried to take the value using a LongInt type variable and it worked! I assume a Delphi "Longint" is 32-bits, then? In most current languages I think an Int or integer is 32-bits in any case. In C/C++ you can have a "short int" too (16-bits). Some versions support "long long" for 64bits but Microsoft C/C++ seems to have special types like _int64. One of the problems in C/C++ is that types like "int" are actually of undefined length -- they are the length of a 'normal' number on the hardware being used. Hence compiler-system-defined types like _int8, _int16, _int32 and _int64. Regards Pete Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now