Skip to content

petrsnd/Cfa533Rs232

Repository files navigation

Build status nuget License

Cfa533Rs232

C# Driver for CrystalFontz CFA533 family of 16x2 LCD displays, RS232 inteface; Developed against the CFA533-TMI-KU

1.0 update was to support .NET Standard 2.0!

NuGet

Cfa533Rs232Driver package on nuget.org.

To install CrystalFontz CFA533 Serial Driver, run the following command in the Package Manager Console:

PM> Install-Package Cfa533Rs232Driver

Sources

There are three projects included in the solution:

  • Cfa533Rs232Driver -- This is the main library that drives the CFA533 via serial port communications.
  • Cfa533Rs232Tool -- A command-line tool for exercising all currently implemented CFA533 commands.
  • Cfa533Rs232Demo -- A command-line tool that implements slightly higher-level device interactions.

Examples

Create an LCD device with the appropriate serial port name. My CFA533 is usually given 'COM3 and, by default, communicates at 19200 baud rate.

using (var lcdDevice = new LcdDevice("COM3", LcdBaudRate.Baud19200))
{
    // You must call Connect() before trying to communicate with the device
    lcdDevice.Connect();
    
    // Call lots of methods here...
    lcdDevice.SetLcdContents("Hello", "World!");
}

In order to support keypad events you need to register an event handler.

EventHandler<KeypadActivityEventArgs> eventHandler =
    delegate(object sender, KeypadActivityEventArgs eventArgs)
    {
        Console.WriteLine($"Keyboard Event: {eventArgs.KeypadAction}");
    }
lcdDevice.KeypadActivity += eventHandler;

The CFA533 is meant to handle one command at a time. There is a lock that ensures that only one command is waiting for a response to be acknowledged before additional commands are sent. However, keypad events may come at any time. This driver works pretty well in a multithreaded environment, although I have noticed an issue here and there with clean-up where not all threads know that Disconnect() has been called. In general, this should just produce a DeviceConnectionException stating that the device is not connected.

About

Driver for CrystalFontz CFA533 family of 16x2 LCD displays; Developed against the CFA533-TMI-KU

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •  

Languages