Serial Port Complete - Latest Microcontroller projects

(lily) #1

Chapter 10


The ErrorReceived routine can check to find out which error has occurred and
can take action as needed. This example just displays a message on error:

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


Dim SerialErrorReceived1 As SerialError

SerialErrorReceived1 = e.EventType

Select Case SerialErrorReceived1

Case SerialError.Frame
Console.WriteLine("Framing error.")

Case SerialError.Overrun
Console.WriteLine("Character buffer overrun.")

Case SerialError.RXOver
Console.WriteLine("Input buffer overflow.")

Case SerialError.RXParity
Console.WriteLine("Parity error.")

Case SerialError.TXFull
Console.WriteLine("Output buffer full.")
End Select
End Sub
Free download pdf