Jump to content
The simFlight Network Forums

Recommended Posts

Posted

VB or other code guru (if still outhere)... I understand offset 0898 with notes states it giving of 0-16384 for Jetliner engine... what does that factor up in vb or other code language?

0 subtract 16384?

16384 subtract 0?

16384/0?

or what?

Posted

Yes I am creating gauges using VB6 codes and I am trying to figure out how to get it working or proper aligned.... And with offset 0898, 2 bit can have range from 0-16384. So I am not sure how to factor it up... let me give you code example

I wrote....

Dim N1Gauge as long
Dim N1Angle as long

If FSUIPC_Read(&H898, 2, VarPtr(N1Gauge), dwResult) Then
If FSUIPC_Process(dwResult) Then
End if
End If

 N1Gauge = 0 ?? <--- Is that what it should be?
 N1Angle = N1Gauge

 If N1Gauge > 0.1 Then N1Angle = 0.1
 Else
 If N1Gauge <  0.1 Then N1Angle = 200
End If

This didn't once worked I must have it factored up wrong or the code is wrong. Let me know

Posted

If FSUIPC_Read(&H898, 2, VarPtr(N1Gauge), dwResult) Then
    If FSUIPC_Process(dwResult) Then
        Isn't something aupposed to be here???
    End if
End If

Overall, this confuses me. If I understand correctly, you're checking to see IF... FSUIPC_Read(&H898, 2, VarPtr(N1Gauge), dwResult) is >0 but if so, you're then checking to see IF... FSUIPC_Process(dwResult) is > 0, but if so, there's nothing happening.

 N1Gauge = 0 ?? <--- Is that what it should be?
 N1Angle = N1Gauge

This assigns a zero value to N1Gauge and then makes N1Angle also equal 0.

 If N1Gauge > 0.1 Then N1Angle = 0.1
 Else
 If N1Gauge <  0.1 Then N1Angle = 200
End If

So then why would you check to see if N1Gauge is > 0.1 when you just assigned it to zero. Also, N1Gauge would never be < 0.1. Zero is the lowest value that H898 returns.

What exactly are you trying to accomplish?

Posted

The code gived above was an example code... its not a determine to be written. This is why I brought up question, i just wanted to know what is need to be factored up to get exact value out of the offset 0898...What I am trying to accomplish is getting the null value to max value to be able generate gauge movement, and display correct number on label.caption.. I constantly getting werid number such as 0 to 16384, not 0-100 percent or something.

Hope that clears up....

Posted

Okay, I think I understand now, this makes more sence in relation to the Factor Question. So you want to covert 0-16384 to 0-100? That's easy Percentage = InputValue / 163.84. This will give you the 0-100 percentage.

To scale the 0-16384 to 0-100, use 16384/100=163.84.

If you want to scale it to an RPM, let's say a max RPM of 2000, use 16384/2000=8.192

Is this what you're looking for?

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.