Skip to content
/ dsub Public

Class for .NET that builds upon the built-in SerialPort class.

License

Notifications You must be signed in to change notification settings

swvincent/dsub

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

dsub

dsub is a class that builds upon .NET's built-in SerialPort class. It adds functionality to deal with multi-threading, error-handling, etc.

It is based on what I've learned from Jan Axelson's book Serial Port Complete Second Edition and the sample applications available on her website. If you're interested in learning more about Serial Ports and/or using them in .NET, I highly recommend checking out her book and website.

dsub uses SerialPort.ReadLine(), so it's required that any data being received has a defined "end of transmission" character, such as a carriage return or line feed. If you have a situation where there isn’t a defined end of transmission character, then dsub won’t work.

Getting Started

To use dsub, just add the ComPort class to an existing application.

Compatibility

dsub targets .NET Framework 4.7 / C# 7.0. As a result, it's compatible with Windows 7, 8.1 and 10.

If you need compatibility with older versions of Windows, you can use the net40 branch which targets .NET Framework 4.0. The code is a little messier but it provides the same functionality as the master branch.

Example Application

The GUI application that’s included will read data from the selected serial port and display it in a grid. If a field delimiter is specified, it will use that to break up the data into separate columns in the grid. At the bottom of the screen, you can enter text to be sent. There is also a textbox where errors will be displayed. The application implements all the features of dsub so it provides a good example of how to use it.

License

This project is licensed under the MIT License - see the LICENSE.md file for details

Acknowledgments