Jump to content
The simFlight Network Forums

Help whit 07CC (AP Heading Value) VB6


Recommended Posts

Pete,

I write a script with Visual Basic 6, and I need to write a heading in the auto Pilot Heading Display the variable is 07CC (AP Heading Value), I use this code:

Public Function set_hdgAP(numHdg As Integer) As Boolean

xResult = numHdg * 65536 / 360

Call FSUIPC_Write(&H7CC, 2, VarPtr(xResult), dwresult)

Call FSUIPC_Process(dwresult)

End Function

Example:

a = 360

Call set_hdgAP(a)

But I don’t now what happen and don’t work.

The Display doesn’t show me the heading that I insert.

I need to write a heading in the heading display of my auto pilot.

Thanks :D

Link to comment
Share on other sites

[

The Display doesn’t show me the heading that I insert.

360 wasn't a good example to start with, was it? That's the same as 0 (and that's what would be written). What did you get displayed?

I don't know VB at all, so maybe someone else will help you, but one thing that would puzzle me is the absense of any definition of what "xResult" is. Shouldn't that be defined someplace?

Pete

Link to comment
Share on other sites

I try whit 360°, 010°, 045°, 090°, 100°, 150°, 180°, etc… all the grades, and don’t resolve the problem, I don’t know but some one called JD helps me, when I publish the last topic, something whit Headings.

I’m making a cockpit whit 2 engineers but electrical engineers. I really need help.

Thanks for all Pete, :wink:

Link to comment
Share on other sites

I try whit 360°, 010°, 045°, 090°, 100°, 150°, 180°, etc… all the grades, and don’t resolve the problem

And what results did you get? You need to talk about both inputs and outputs to a problem. You ARE using a default aircraft, aren't you? If you are trying to do with with sophisticate panels like those from PMDG, Level D and PSS you will probably never get it working as they tend to use their own autpilots, not the built-in FS one.

I don’t know but some one called JD helps me, when I publish the last topic, something whit Headings.

I'm afraid JD is away all week. Perhaps he will see your questions next week.

Have you tried using some of the facilities in FSUIPC to see what is going on? That should be your first step. Please use the Logging -- you can Log the IPC reads, and see what you are asking FSUIPC for and what it is providing.

Then, of course, there must surely be some debugging facilities in VB? I can't understand how any one ever gets a VB program working otherwise. All the code, including that inside the FSUIPC routines you are calling, is in your hands. All you need to do is find out what is wrong. You can trace it step-by-step.

Regards

Pete

Link to comment
Share on other sites

Pete, about outputs and inputs, when I use any grade (360° = 0°, 010°, etc..) the result is 0, in all the cases, I reed al the SDK but I think that the problem is about the math formula, ok I don’t know with accuracy, but I try everything, and the result is the same 0.

About the aircraft I use a FS aircraft not PSS, PMDG, Level D, etcetera. Use Bombardier Lear Jet 45. But the Idea is to use the software whit Dash 8 of PSS.

If you have may be an idea, please tell me, I am creasy for the answer. Equal will repeat the process step by step…

Thanks, :?

Me..

Link to comment
Share on other sites

Now that thinks, may be the answer to all my problems is to learn how to program in C, I have attempted it, but it is confused.

Parallel I believe that I will begin to investigate C

May be in these days I will ask you again, things in C, we will already see that jejeje.

Regards...

:P

Link to comment
Share on other sites

Pete, about outputs and inputs, when I use any grade (360° = 0°, 010°, etc..) the result is 0, in all the cases, I reed al the SDK ...

I didn't suggest to read the SDK again, but to use the tools at your disposal to check what is happening, like using FSUIPC Logging, and using a Debugger for VB.

I don't understand why so many VB programmers don't seem to understand about debugging. Doesn't the VB package come with any tools for this? How do they get programs working at all?

... but I think that the problem is about the math formula, ok I don’t know with accuracy, but I try everything, and the result is the same 0.

One more thought. You said you defined xResult as

Dim xResult as Integer

Now I always assumed an Integer on a 32-bit system was 32-bits. What you are seeing might be explained if an Integer in your compiler is only 16 bits. Both numHdg and xResult would be too small for the intermediate result.

Alternatively, it would also be explained if the compiler worked backwards and divided your value by 360 before multiplying by 65536. Try forcing the order by

xResult = (numHdg * 65536) / 360

I tend to always use parentheses for such things in any case as I don't wholly trust compilers! ;-)

If you have may be an idea, please tell me, I am creasy for the answer. Equal will repeat the process step by step…

Have you any books on VB to learn more about it? It seems to me the answer is in understanding the language you use more thoroughly, and then trying to debug it correctly.

I've now really helped about as much as I can I'm afraid.

Regards

Pete

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • 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.