Serial Port Complete - Latest Microcontroller projects

(lily) #1

Chapter 12


An application can set a variable (acceptData in the example below) that indi-
cates whether the most recent address was a match (True) or not (False):

 Dim acceptData as Boolean
Dim myAddress As Integer = Microsoft.VisualBasic.AscW("h")


Private Sub ErrorReceived _
(ByVal sender As Object, ByVal e As SerialErrorReceivedEventArgs)

Dim SerialErrorReceived1 As SerialError

SerialErrorReceived1 = e.EventType

Select Case SerialErrorReceived1

Case SerialError.RXParity

If (myComPort.ReadChar = myAddress) Then
acceptData = True
Else
acceptData = False
End If

End Select
End Sub
Free download pdf