High-Octane Posted June 21, 2005 Report Share Posted June 21, 2005 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? Link to comment Share on other sites More sharing options...
Skittles Posted June 21, 2005 Report Share Posted June 21, 2005 0 subtract 16384?16384 subtract 0? 16384/0? I'm not sure what you mean by this. Are you creating a Visual Basic (VB) program? Link to comment Share on other sites More sharing options...
High-Octane Posted June 21, 2005 Author Report Share Posted June 21, 2005 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 Link to comment Share on other sites More sharing options...
Skittles Posted June 21, 2005 Report Share Posted June 21, 2005 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? Link to comment Share on other sites More sharing options...
High-Octane Posted June 21, 2005 Author Report Share Posted June 21, 2005 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.... Link to comment Share on other sites More sharing options...
Skittles Posted June 21, 2005 Report Share Posted June 21, 2005 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? Link to comment Share on other sites More sharing options...
High-Octane Posted June 21, 2005 Author Report Share Posted June 21, 2005 Yes :D that is what I am looking for... Thanks Link to comment Share on other sites More sharing options...
Skittles Posted June 21, 2005 Report Share Posted June 21, 2005 Glad to be of help. 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