Sign in to follow this  
Guest jprouty

Designing Instruments for Visual Basic?

Recommended Posts

Hi All,What's the best way to design instruments for use in a simulator written in Visual Basic? I'm trying to find out if there are any software/freeware packages out there that would let me design the basic flight instruments or import existing ones.Thanks,Jim

Share this post


Link to post
Share on other sites
Help AVSIM continue to serve you!
Please donate today!

JimGlobal Majic has a aircraft insturment package for VB. You can download the package and if you do not register it you get a nag screen when your program is opened.http://www.globalmajic.com/downloads.asp?PTID=10I am currently playing with these with a Tablet PC running windows 95. It works pretty good but the tablet is a little slow and it is grey scale.Dave

Share this post


Link to post
Share on other sites

Take a look at my FSPanel application in the library. http://forums.avsim.net/user_files/98026.gifIt's written in Visual Basic. The Primary Flight Instuments are from the Global Majic package, the secondary ones such as the engine gauges I wrote myself. This is designed to be run on a simple PC - I use an old 486 laptop - so there's no OpenGL etc, but you don't need that for a flat panel.Richard

Share this post


Link to post
Share on other sites

Thanks for the great information!Dave, I tried downloading the FSPanel but I can't get it to download. Will try again later. You panels look great! Hope I can come up with something that nice.Thanks again,Jim

Share this post


Link to post
Share on other sites

Looks like I'm batting 1000! The Global Majic sofware seems to just be demos now. Can't do anything but watch demos and can't do any work with the instruments. :( Will give them a call on Monday.Thanks again for everyone's help. Jim

Share this post


Link to post
Share on other sites

To actually "play" with the instruments from Global Majic, open Visual Basic and open either a new or existing project. Click on Project / Components to view the list of installed controls. Click on "Browse" and go to the location you unzipped the Global Majic package to. Double click the "Airs.ocx" file and it'll add the instrument package to your available VB components.I don't know why you can't download the FSPanel application, it downloaded fine for me just now.If for some reason you can't get it, let me have your email address and I'll email you a copy.Richard

Share this post


Link to post
Share on other sites

JimHere is the code I am using for tow insturments the HSI and AH. You must have FSUIPC.BAS in your modules folder in the project. I have set the colors for grey scale so if you are using a color monitor you should change them to the defaults.Hope this helpsDave*****************************************************************Option Explicit_________________________________________________________________Private Sub Exit_Click()Call FSUIPC_CloseEndEnd Sub_________________________________________________________________Private Sub Form_Load()Call FSUIPC_InitializationCall FSUIPC_Open(SIM_ANY, dwResult)Timer1.Enabled = TrueEnd Sub_________________________________________________________________Public Sub Get_Data()Dim roll As DoubleDim bug As LongDim ADF As LongDim RAD1 As LongDim OBS As LongDim GLSL As IntegerDim loc1 As IntegerDim loc2 As IntegerDim vari As LongDim IAS As LongDim HEADING As LongDim DME(5) As ByteDim dme1 As StringDim NG As LongDim RG As LongDim LG As LongDim dwResult As LongDim hdg As LongDim pitch As DoubleDim LOC As IntegerAH.AHFlightDirectorColor = &HFFFFFFAH.AHReferenceColor = &HFFFFFFCall FSUIPC_Read(&H2F70, 8, VarPtr(pitch), dwResult)Call FSUIPC_Read(&H2F78, 8, VarPtr(roll), dwResult)Call FSUIPC_Process(dwResult)Call FSUIPC_Read(&H7CC, 2, VarPtr(hdg), dwResult)Call FSUIPC_Process(dwResult)AH.FrameStyle = 2AH.ADFBearing = 2AH.AHBug = FalseAH.AHBugHeading = ((bug * 655.36) / 0.36) * 100AH.AHHeading = (hdg) * (0.36 / ((429496.7296) * 1000)) * 100AH.AHPitch = -(pitch)AH.AHRoll = -(roll)Call FSUIPC_Read(&HC48, 1, VarPtr(LOC), dwResult)Call FSUIPC_Read(&HC49, 1, VarPtr(GLSL), dwResult)Call FSUIPC_Process(dwResult)Call FSUIPC_Read(&HC29, 5, VarPtr(DME(1)), dwResult)Call FSUIPC_Read(&HC4E, 2, VarPtr(OBS), dwResult)Call FSUIPC_Process(dwResult)loc1 = Abs(LOC)Select Case loc1 Case 0 To 127 loc2 = loc1 Case Else loc2 = loc1 - 255End Select Select Case GLSL Case 0 To 127 GLSL = GLSL Case Else GLSL = GLSL - 255End Select HSI.HSIGlideSlopeDelta = 50HSI.HSIGlideSlopeDeviation = GLSLHSI.HSICourseDelta = 75HSI.HSICourseDeviation = loc2dme1 = ChrW(DME(1)) & _ ChrW(DME(2)) & _ ChrW(DME(3)) & _ ChrW(DME(4)) ' & _HSI.HSIDistance = dme1HSI.HSIBug = TrueHSI.HSIBugHeading = (hdg * 360) / 65536HSI.HSICourseHeading = OBS '(hdg) * (0.36 / ((429496.7296) * 1000)) * 100HSI.HSICompass = TrueCall FSUIPC_Read(&H580, 4, VarPtr(HEADING), dwResult)Call FSUIPC_Read(&H2A0, 2, VarPtr(vari), dwResult)Call FSUIPC_Process(dwResult)HSI.HSIHeading = (HEADING * (0.36 / ((429496.7296) * 1000)) * 100) - ((vari * 360) / 65536)'****ADF needle ******************************************************Call FSUIPC_Read(&H2D8, 2, VarPtr(ADF), dwResult)Call FSUIPC_Read(&H2BC, 4, VarPtr(IAS), dwResult)Call FSUIPC_Process(dwResult)HSI.HSIBearing = (ADF * 360) / 65536HSI.HSISpeed = IAS / 128'*********Gear*****************************************************Call FSUIPC_Read(&HBEC, 4, VarPtr(NG), dwResult)Call FSUIPC_Read(&HBF0, 4, VarPtr(RG), dwResult)Call FSUIPC_Read(&HBF4, 4, VarPtr(LG), dwResult)Call FSUIPC_Process(dwResult)Select Case NGCase 0GN.FillStyle = 0GN.FillColor = &HFFFFFFFrame1.Caption = " GEAR UP"Case Is > 16000GN.FillStyle = 0GN.FillColor = &H0Frame1.Caption = " GEAR Down"Case ElseGN.FillStyle = 4GN.FillColor = &HC0C0C0Frame1.Caption = "GEAR Unlocked"End SelectSelect Case RGCase 0GR.FillStyle = 0GR.FillColor = &HFFFFFFCase Is > 16000GR.FillStyle = 0GR.FillColor = &H0Case ElseGR.FillStyle = 4GR.FillColor = &HC0C0C0End SelectSelect Case LGCase 0GL.FillStyle = 0GL.FillColor = &HFFFFFFCase Is > 16000GL.FillStyle = 0GL.FillColor = &H0Case ElseGL.FillStyle = 4GL.FillColor = &HC0C0C0End SelectEnd Sub_________________________________________________________________Private Sub Timer1_Timer()Get_DataEnd Sub_________________________________________________________________

Share this post


Link to post
Share on other sites

Dave, to substantially speed up the response of your app, try putting all the FSUIPC_Read commands one after the other, and then calling FSUIPC_Process at the end....Call FSUIPC_Read(&H2F70, 8, VarPtr(pitch), dwResult)Call FSUIPC_Read(&H2F78, 8, VarPtr(roll), dwResult)Call FSUIPC_Read(&H7CC, 2, VarPtr(hdg), dwResult)Call FSUIPC_Read(&HC48, 1, VarPtr(LOC), dwResult)Call FSUIPC_Read(&HC49, 1, VarPtr(GLSL), dwResult)Call FSUIPC_Read(&HC29, 5, VarPtr(DME(1)), dwResult)Call FSUIPC_Read(&HC4E, 2, VarPtr(OBS), dwResult)Call FSUIPC_Read(&H580, 4, VarPtr(HEADING), dwResult)Call FSUIPC_Read(&H2A0, 2, VarPtr(vari), dwResult)Call FSUIPC_Read(&H2D8, 2, VarPtr(ADF), dwResult)Call FSUIPC_Read(&H2BC, 4, VarPtr(IAS), dwResult)Call FSUIPC_Read(&HBEC, 4, VarPtr(NG), dwResult)Call FSUIPC_Read(&HBF0, 4, VarPtr(RG), dwResult)Call FSUIPC_Read(&HBF4, 4, VarPtr(LG), dwResult)Call FSUIPC_Process(dwResult) The way you have it at the moment is very slow - each FSUIPC_Process has to be run each time the code loops, and that's the most time consuming line in the whole app.Richard

Share this post


Link to post
Share on other sites

Thanks again for all of the great help! I hope to be able to give this a try on Monday. All of this looks like exactly what I want to do. :)Jim

Share this post


Link to post
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
Sign in to follow this