I now have the Witilt working well with a VB program I have written. Here are the main functions to setup and gather data.
Option Explicit
Public Function OpenAccelerometerPort() As Boolean
'opens the accelerometer port and returns true or false if successful
If frmAnalysis.MSCommAccelerometer.PortOpen Then frmAnalysis.MSCommAccelerometer.PortOpen = False
DoEvents
With frmAnalysis.MSCommAccelerometer
.CommPort = accelcomportnum
'.PortOpen = True
.Settings = “115200,N,8,1”
.InputLen = 0
End With
DoEvents
'test to see if opened and running
If frmAnalysis.MSCommAccelerometer.PortOpen Then
OpenAccelerometerPort = True
Else
OpenAccelerometerPort = True
End If
End Function
Public Sub CollectAccelerometerData(start As Boolean)
'turn data stream from accelerometer on or off
'check to see if port is open
If frmAnalysis.MSCommAccelerometer.PortOpen = False Then OpenAccelerometerPort
If start Then
'start collecting accelerometer data
’ Send the command to the accelerometer to begin data send.
SendToAccelerometer (accelstart)
starttime = timeGetTime
accelbuffer = “”
accelst = 1
samplecount = 0
prevsamplecount = 0
Else
'stop accelerometer data collection
SendToAccelerometer (accelstart)
End If
End Sub
Public Function GetAccelerometerData() As String
'retrieves the contents of the accelerometer comms port buffer
Dim intext As String
If frmAnalysis.MSCommAccelerometer.PortOpen = False Then Exit Function
Do
intext = intext + frmAnalysis.MSCommAccelerometer.Input
DoEvents
Loop While frmAnalysis.MSCommAccelerometer.InBufferCount >= 1
GetAccelerometerData = intext
End Function
Public Sub SendToAccelerometer(txt As String)
'send the txt to the accelerometer
If frmAnalysis.MSCommAccelerometer.PortOpen Then
frmAnalysis.MSCommAccelerometer.Output = txt
DoEvents
End If
End Sub