[aprssig] Visual Basic Serial Input?

vk6ufo at multiline.com.au vk6ufo at multiline.com.au
Tue Jun 21 18:24:28 EDT 2011


> Does anyone have a VB routine that just sits there and runs the serial
> port
> for input and captures strings when they come in?  Event driven by the
> strings?
>
> I have a student working on a telemetry input routine and he can't figure
> out how to just let it run all the time taking care of its own timeouts
> and
> only returning data when it has it.

Bob, if the student is using the standard MSCOMM32 for serial comms then
the object will generate an event when data arrives. For example if the
object is named "Comm" then:

Private Sub Comm_OnComm()
  Dim Dat$
  Select Case Comm.CommEvent
    Case comEvReceive
      Dat$ = Comm.Input
      'Process dat$ here
  End Select
End Sub

The RThreshold attribute will determine how many characters must be
received for the event to occur. If the strings are of random length then
the student will need to build a buffer and parse out the strings. Very
easy if the strings are sentences a-la NMEA, Ultimeter weather etc.






More information about the aprssig mailing list