Jump to content
The simFlight Network Forums

New in FSUIPC use


Recommended Posts

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

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

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use. Guidelines Privacy Policy We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.