Serial Port Complete - Latest Microcontroller projects

(lily) #1

Chapter 10


Overrun errors indicate that UART’s buffer filled and overflowed because the
driver was unable to retrieve data from a full buffer before new data arrived. A
slower bit rate can eliminate this error.

: 35 
  8 

$


As Chapter 2 explained, applications can use hash values and other checksums
to verify that received data hasn’t been corrupted while transmitting. The Sys-
tem.Security.Cryptography namespace provides classes that implement hash
values. To implement error checking with embedded systems that don’t support
hash values, applications can use simpler checksum algorithms or parity bits.

  
 $$#  


An application that accesses COM ports might define a class for managing
COM-port communications, events for passing notifications and data, and
combo boxes for setting port parameters. This section shows how to use these
elements in applications.

$ 3  


#


An application can define a class to hold the code that configures and accesses
COM ports:

 Public Class ComPorts


' Place class code here.

End Class

 public class ComPorts
{
// Place class code here.
}
Benefits of using a separate class can include code that is more portable, more
readable, and easier to debug. A ComPorts class is likely to have both shared
and private members, The shared members can handle tasks that aren’t specific
to a single port, such as finding and maintaining a record of the system’s ports.
Private members can handle tasks that are specific to a port, such as opening

Free download pdf