Jump to content
The simFlight Network Forums

HOW to display HDG,SPD,ALT on MCP to C#


Recommended Posts

   As this topic i have read about offset , EVENT and i can program C# to PMDG 737 So could you tell me or show me ex code to help me Thank you. 

 

Sorry, I don't know C#. Isn't the example of the interface in the SDK of use? Once you know which offset to use, what would be the problem?

 

Have you considered using Paul Henty's .NET DLL? It makes such things much easier -- see the SubForum about this, above.

 

Pete

Link to comment
Share on other sites

Hi Pete, 

 

I am trying to read HDG but got some fantastic number like 121823238 however I can read speed and altitude normally. Could you please help me to solve this issue ? 

 

my delphi  code is :

procedure TFormMain.TimerUpdateTimeTimer(Sender: TObject);
var
  dwResult : DWORD;
  auiTime  : Array[1..3] of Byte;
  altitude:DWord;
  IAS: DWord;
  G_force: DWord;
  St: DWord;
  HDG: DWord;
 
begin
 
  FSUIPC_Read($3324, 8, @altitude, dwResult); //
  FSUIPC_Read($02BC, 4, @IAS, dwResult);  // 
  FSUIPC_Read($11BA, 4, @G_force, dwResult);
  FSUIPC_Read($0580, 4, @HDG, dwResult);  // 
 
  FSUIPC_Process(dwResult);
  Label4.Caption := IntToStr(round(altitude )) + ' ft';
  Label5.Caption := IntToStr(round(IAS / 128)) + ' kt';
  Label6.Caption := IntToStr(round( G_force/625));
  Label7.Caption := IntToStr(round(HDG*360/65536*65536));
 
Thanks in Advance 
 
Hikmat
Link to comment
Share on other sites

I am trying to read HDG but got some fantastic number like 121823238 however I can read speed and altitude normally. Could you please help me to solve this issue ? 

...

  Label7.Caption := IntToStr(round(HDG*360/65536*65536));

 

The arithmetic operations / and * have the same priority, so are obeyed left to right -- so you are getting

 

          ((HDG * 360) / 65356) * 65536

 

You need to use parentheses exactly as shown in the dox.

 

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.