Partilhar via


Serial Communication Application Sample

This sample demonstrates serial communications with a serial LCD device. This sample is available only in Visual C#.

For information about using the samples, see the following topics:

To build the sample using Visual Studio

  1. Open Windows Explorer and navigate to the CS subdirectory of the SerialLCDCS directory.

  2. Double-click the SerialLCDCS.sln file to open it in Visual Studio.

  3. From the Build menu, select Build Solution.

The application will be built in the default \bin or \bin\Debug subdirectory.

To run the sample

  1. In Windows Explorer or in the Command Prompt window, navigate to the directory that contains the new executable file.

  2. Double-click the icon for the SerialLCDCS file in Windows Explorer, or type SerialLCDCS in the Command Prompt window to open the application.

Remarks

This sample requires a LCD device, but if you do not have a device the code is still demonstrative of the following:

  • Declaring an instance of a SerialPort.

  • Reading and writing to the port.

  • Controlling the communication protocol with the device.

  • Closing the port.