Hello, I am new to vb and I need some help from you all. I have to do a project which is interface an vane anemometer to computer by parallel port. I have done almost everything now i only left with the programme. My idea is the anemometer will give me an 'on' and I will start to take the time and stop when it off. Then I can calculate the speed.
here are my form code:
Private Sub start_click()
Dim speed As Double
Dim fre As Double
Text1.Text = "0"
Dim ino As Integer
Dim GMTime As SYSTEMTIME
Dim TheTime As String
Dim a As Double, b As DoubleGetSystemTime GMTime
a = GMTime.wSecond + 0.001 * GMTime.wMilliseconds
For x = 1 To 10000
PortAddress = Val(&H378)
ino = InValue(PortAddress + 1)Next
GetSystemTime GMTime
Timer1.Interval = 1
b = GMTime.wSecond + 0.001 * GMTime.wMillisecondsspeed = 0.127 / (b - a)
Text1.Text = speed
End SubPrivate Sub stop_click()
Text1.Text = "0"
End Sub
here are my module code:
Public Declare Function InValue Lib "inpout32.dll" _
Alias "Inp32" (ByVal PortAddress As Integer) As Integer
Public Declare Sub Out Lib "inpout32.dll" _
Alias "Out32" (ByVal PortAddress As Integer, ByVal Value As Integer)
Public Declare Sub GetSystemTime Lib "kernel32" (lpSystemTime As SYSTEMTIME)
Public Declare Function SetSystemTime Lib "kernel32" (lpSystemTime As SYSTEMTIME) As LongPublic Type SYSTEMTIME
wYear As Integer
wMonth As Integer
wDayOfWeek As Integer
wDay As Integer
wHour As Integer
wMinute As Integer
wSecond As Integer
wMilliseconds As Integer
End Type
my problem are
a) how to read the parallel port in visual basic (I use pin no.13).
b) how to loop it.
Thanks.