Captain_Slarty
01-09-2002, 07:21 AM
LAST EDITED ON Jan-09-02 AT 07:39AM (EDT)[p]Ok, a simple project to start with.
object:
What we will do is make fs2002 display a message when the airpseed increases above a set limit.
the message will be "My Program Worked - Hello World"
you gotta have a 'hello world' :-lol
we will read the airspeed variable from fs2002/fsuipc and then call a routine to display it in the message window of 2002.
the principle is the same for interfacing to the outside world, ie, cockpit displays, once you have obtained the variable, you can then send it to the comm port, or, to usb, or whatever.
what you need.
fs2002, of course :-roll
fsuipc latest instaled in the modules directory.
the fsuipc sdk (Sample program fsuipc hello - tested and working)
a print out of the fsuipc for programmers (Word Doc)
vb (Visual basic)
first part will be this evening and will include setting up a program in vb that has a couple of sub routines to call. fusipc read and fsuipc write. - a sub to read the airpseed, and then a call to the write offset for the adventure text.
that should do for a start.
Captn S.
Acknowledgements.
Peter Dowson for FSUIPC
Chris Brett for the vb sdk for fsuipc.
Microsoft for fs2002 and VB
load fsuipc hello
clear (delete) the form code and then add these subs / code. (also a dd a timer (timer1) to the form.
' airspeed read and display warning Captain Slarty 2001
Dim dwResult As Long
Dim dwOffset As Long
Dim dwSize As Long
Dim ptr As Long
Dim asi As Long
Private Sub butOK_Click()
Unload frmMain
End Sub
Private Sub Form_Load()
End Sub
Private Sub Form_Unload(Cancel As Integer)
' close connection to UIPC
FSUIPC_Close
End Sub
Private Sub Timer1_Timer()
' make the calls here
'test of airspeed
airspeed
End Sub
Private Sub Read_fsuipc()
'dwoffset is in uipc table hex
'dwsize is size of item in ipc table
' pdest=varptr(item)
'dwresult=long
If FSUIPC_Read(dwOffset, dwSize, ptr, dwResult) Then
' "Read" proceeded without any problems
If FSUIPC_Process(dwResult) Then
' "Process" proceeded without any problems
' do something with the result here
Else
' Unable to "Process"
MsgBox "problem with process"
End If
Else
' Unable to "Read"
MsgBox "unable to read"
End If
End Sub
Private Sub write_fsuipc()
' set the items here prior to call
If FSUIPC_Write(dwOffset, dwSize, ptr, dwResult) Then
If FSUIPC_Process(dwResult) Then
Else
' Unable to "Process"
MsgBox "problem with process"
End If
Else
' Unable to "write"
End If
End Sub
Private Sub airspeed()
end sub
save your project as airspeedtest
more later tonight. :-)
http://www.captainslarty.com/images/sl0015fps.gif
object:
What we will do is make fs2002 display a message when the airpseed increases above a set limit.
the message will be "My Program Worked - Hello World"
you gotta have a 'hello world' :-lol
we will read the airspeed variable from fs2002/fsuipc and then call a routine to display it in the message window of 2002.
the principle is the same for interfacing to the outside world, ie, cockpit displays, once you have obtained the variable, you can then send it to the comm port, or, to usb, or whatever.
what you need.
fs2002, of course :-roll
fsuipc latest instaled in the modules directory.
the fsuipc sdk (Sample program fsuipc hello - tested and working)
a print out of the fsuipc for programmers (Word Doc)
vb (Visual basic)
first part will be this evening and will include setting up a program in vb that has a couple of sub routines to call. fusipc read and fsuipc write. - a sub to read the airpseed, and then a call to the write offset for the adventure text.
that should do for a start.
Captn S.
Acknowledgements.
Peter Dowson for FSUIPC
Chris Brett for the vb sdk for fsuipc.
Microsoft for fs2002 and VB
load fsuipc hello
clear (delete) the form code and then add these subs / code. (also a dd a timer (timer1) to the form.
' airspeed read and display warning Captain Slarty 2001
Dim dwResult As Long
Dim dwOffset As Long
Dim dwSize As Long
Dim ptr As Long
Dim asi As Long
Private Sub butOK_Click()
Unload frmMain
End Sub
Private Sub Form_Load()
End Sub
Private Sub Form_Unload(Cancel As Integer)
' close connection to UIPC
FSUIPC_Close
End Sub
Private Sub Timer1_Timer()
' make the calls here
'test of airspeed
airspeed
End Sub
Private Sub Read_fsuipc()
'dwoffset is in uipc table hex
'dwsize is size of item in ipc table
' pdest=varptr(item)
'dwresult=long
If FSUIPC_Read(dwOffset, dwSize, ptr, dwResult) Then
' "Read" proceeded without any problems
If FSUIPC_Process(dwResult) Then
' "Process" proceeded without any problems
' do something with the result here
Else
' Unable to "Process"
MsgBox "problem with process"
End If
Else
' Unable to "Read"
MsgBox "unable to read"
End If
End Sub
Private Sub write_fsuipc()
' set the items here prior to call
If FSUIPC_Write(dwOffset, dwSize, ptr, dwResult) Then
If FSUIPC_Process(dwResult) Then
Else
' Unable to "Process"
MsgBox "problem with process"
End If
Else
' Unable to "write"
End If
End Sub
Private Sub airspeed()
end sub
save your project as airspeedtest
more later tonight. :-)
http://www.captainslarty.com/images/sl0015fps.gif