Jump to content
The simFlight Network Forums

Question about reading altitude offset [Moved from "FSUIPC version 5.13 key settings"]Q


Recommended Posts

Hello Sir,

 I buy the FSX and download FSUIPC 4  unregistered version, and I use the example C program

to interface  FSUIPC to get FSUIPC_Version, FSUIPC_FS_Version as well Time from FSX.

VERY GOOD. However,  I want to get (read) 0x570 Altitude values, but the Altitude values

are always 0.  Questions:  1) It is because the FSUIPC 4 is not registered, so that  the Altitude

values always are 0.  or 2) It is because my program problem, so that the Altitude values always

are 0.  3) How to pay money to register FSUIPC to get the registered key code, I am in Vienna.

Link to comment
Share on other sites

Hello Sir,

 I buy the FSX and download FSUIPC 4  unregistered version, and I use the example C program

to interface  FSUIPC to get FSUIPC_Version, FSUIPC_FS_Version as well Time from FSX.

VERY GOOD. However,  I want to get (read) 0x570 Altitude values, but the Altitude values

are always 0.  Questions:  1) It is because the FSUIPC 4 is not registered, so that  the Altitude

values always are 0.  or 2) It is because my program problem, so that the Altitude values always

are 0.  3) How to pay money to register FSUIPC to get the registered key code, I am in Vienna.

The read Altitude program is as follows:

 if (!FSUIPC_Read(0x570, 4, AltitudeChar4, &dwResult) || !FSUIPC_Process(&dwResult))
 {
  AltitudeOk = FALSE;
  printf (" Read AltitudeFra Error! \n");
 }
 else
 {
  AltitudeFra = atoi(AltitudeChar4);
 }

 if (!FSUIPC_Read(0x574, 4, AltitudeChar4, &dwResult) || !FSUIPC_Process(&dwResult))
 {
  AltitudeOk = FALSE;
  printf (" Read AltitudeInt Error! \n");
 }
 else
 {
  AltitudeInt = atoi(AltitudeChar4);
  printf("Altitude = %d.%d \n", AltitudeInt, AltitudeFra);
 }

 

Link to comment
Share on other sites

3 hours ago, yindengxie said:

 I buy the FSX and download FSUIPC 4  unregistered version

So why did you post your questions at the end of an older thread about FSUIPC 5.13 key settings? You are lucky I found your posts. I've split them off into a new thread with a more appropriate title.

3 hours ago, yindengxie said:

I want to get (read) 0x570 Altitude values, but the Altitude values are always 0.  Questions:  1) It is because the FSUIPC 4 is not registered, so that  the Altitude values always are 0.  or 2) It is because my program problem, so that the Altitude values always are 0

It is nothing to do with registration, so you must be making an error.

3 hours ago, yindengxie said:

How to pay money to register FSUIPC to get the registered key code, I am in Vienna.

Just purchase the Registration at SimMarket. The information is provided to you in the documentation -- refer to the User Guide. It's on page 3.

You seem to have repeated all of the first post in the second, so I shall bypass the repeated part.

Quote

 AltitudeFra = atoi(AltitudeChar4);

The values you are reading are NOT characters, they are each 32-bit integers already!  Why did you think they would be chracters? To start with, 4 bytes would then only accommodate yp to 9999 meters, nowhere near adequate!

You read them into an ordinary numeric variable. Take care to treat the fraction part as unsigned.

Really you should treat the whole 8 bytes as a single 64-bit integer (int64).  It will be 2^32 too large if you want meters, so copy it to a double and divide it by (65536.0*65536.0).

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.