nanoFramework.Iot.Device.CharacterLcd 1.1.131

The ID prefix of this package has been reserved for one of the owners of this package by NuGet.org. Prefix Reserved
.NET Framework
dotnet add package nanoFramework.Iot.Device.CharacterLcd --version 1.1.131
NuGet\Install-Package nanoFramework.Iot.Device.CharacterLcd -Version 1.1.131
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="nanoFramework.Iot.Device.CharacterLcd" Version="1.1.131" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add nanoFramework.Iot.Device.CharacterLcd --version 1.1.131
#r "nuget: nanoFramework.Iot.Device.CharacterLcd, 1.1.131"
#r directive can be used in F# Interactive, C# scripting and .NET Interactive. Copy this into the interactive tool or source code of the script to reference the package.
// Install nanoFramework.Iot.Device.CharacterLcd as a Cake Addin
#addin nuget:?package=nanoFramework.Iot.Device.CharacterLcd&version=1.1.131

// Install nanoFramework.Iot.Device.CharacterLcd as a Cake Tool
#tool nuget:?package=nanoFramework.Iot.Device.CharacterLcd&version=1.1.131

Character LCD (Liquid Crystal Display)

This device binding is meant to work with character LCD displays which use a HD44780 compatible controller. Almost all character LCDs fall into this category. Simple wrappers for 16x2 and 20x4 variants are included.

Please make sure you are using the latest nuget.

Documentation

This binding should work and is in preview has been tested with a variety of 16x2 and 20x4 displays both in 4bit and 8bit mode and via i2C adapters (such as on the CrowPi). It should work with any character LCD with a 5x8 size character. Common names are 1602LCD and 2004LCD. Also supports Grove - LCD RGB Backlight.

Usage

These devices are controlled purely by GPIO (except Grove LCD RGB Backlight). There are two different types of GPIO pins that are used, the control pins, and the data pins. The data pins are the ones that will send out the text that should be printed out on the LCD screen. This binding supports two different configurations for the data pins: using 4 data pins, and using 8 data pins. When using only 4 data pins, we will require two send two messages to the controller, each sending half of the byte that should be printed.

Here is a Hello World example of how to consume this binding:

            using LcdInterface lcdInterface = LcdInterface.CreateI2c(_i2cDevice, false);
            using Hd44780 lcd = new Lcd1602(lcdInterface);
            lcd.UnderlineCursorVisible = false;
            lcd.Write("Hello World!");

Grove LCD RGB Backlight uses two i2c devices:

  • the device to control LCD (address 0x3E)
  • the device to control RGB backlight (address 0x62)

Make sure the Grove-LCD RGB Backlight is connected to a I2C port. Not the Digital port! Here is a Hello World example of how to consume Grove LCD RGB Backlight binding:

var i2cLcdDevice = I2cDevice.Create(new I2cConnectionSettings(busId: 1, deviceAddress: 0x3E));
var i2cRgbDevice = I2cDevice.Create(new I2cConnectionSettings(busId: 1, deviceAddress: 0x62));
using LcdRgb lcd = new LcdRgb(new Size(16, 2), i2cLcdDevice, i2cRgbDevice);
{
    lcd.Write("Hello World!");
    lcd.SetBacklightColor(Color.Azure);
}

PCF8574T/PCF8574AT Sample The I2C backpack based on the PCF8574T/AT IC uses specific pin mapping, to consume this device binding on this backpack use like so

var i2cDevice = I2cDevice.Create(new I2cConnectionSettings(busId: 1, deviceAddress: 0x27));
var controller = new Pcf8574(i2cDevice);
var lcd = new Lcd1602(registerSelectPin: 0, enablePin: 2, dataPins: new int[] { 4, 5, 6, 7}, backlightPin: 3, readWritePin: 1, controller: controller);

there is a full working example in the samples directory called Pcf8574tSample.cs For PCF8574T i2c addresses can be between 0x27 and 0x20 depending on bridged solder jumpers and for PCF8574AT i2c addresses can be between 0x3f and 0x38 depending on bridged solder jumpers

This device binding can be combined with the ShiftRegister binding in order to drive an HD44780 display using a shift register. The ShiftRegister binding enables interaction via GPIO or SPI. Any shift register can be used as long as it's output length is evenly divisible by 8. Example:

int registerSelectPin = 1;
int enablePin = 2;
int[] dataPins = new int[] { 6, 5, 4, 3 };
int backlightPin = 7;
// Gpio
using ShiftRegister sr = new(ShiftRegisterPinMapping.Minimal, 8);
// Spi
// using SpiDevice spiDevice = SpiDevice.Create(new(0, 0));
// using ShiftRegister sr = new(spiDevice, 8);
using LcdInterface lcdInterface = LcdInterface.CreateFromShiftRegister(registerSelectPin, enablePin, dataPins, backlightPin, sr);
using Lcd1602 lcd = new(lcdInterface);

The sample code works with Adafruit's I2C / SPI character LCD backpack which uses the Sn74hc595 8-bit shift register to support SPI communication. The pin parameters are set according to the backpack's schematic.

Character LCD display Samples

Different samples are provided. The main method will use the Board's Gpio pins to drive the LCD display. The second example will instead use an MCP Gpio extender backpack to drive the LCD display. Also the second example can use Grove RGB LCD Backlight via i2c bus. This second example has been tested on a CrowPi device and Grove LCD RGB Backlight device.

Product Versions
.NET Framework net
Compatible target framework(s)
Additional computed target framework(s)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on nanoFramework.Iot.Device.CharacterLcd:

Package Downloads
nanoFramework.Iot.Device.Pcd8544 The ID prefix of this package has been reserved for one of the owners of this package by NuGet.org.

This package includes the .NET IoT Core binding Iot.Device.Pcd8544 for .NET nanoFramework C# projects.

GitHub repositories (1)

Showing the top 1 popular GitHub repositories that depend on nanoFramework.Iot.Device.CharacterLcd:

Repository Stars
nanoframework/nanoFramework.IoT.Device
📦 This repo includes .NET nanoFramework implementations for various sensors, chips, displays, hats and drivers
Version Downloads Last updated
1.1.131 172 1/5/2023
1.1.127 154 1/3/2023
1.1.122 183 12/28/2022
1.1.82 428 11/16/2022
1.1.78 234 11/14/2022
1.1.72 387 11/5/2022
1.1.60 320 10/25/2022
1.1.47 327 10/22/2022
1.1.41 561 10/12/2022
1.1.37 378 10/11/2022
1.1.33 481 10/8/2022
1.1.27 347 10/7/2022
1.1.23 561 9/24/2022
1.1.14 642 9/22/2022
1.1.8 236 9/16/2022
1.1.6 266 9/15/2022
1.1.1 274 9/14/2022
1.0.288-preview.155 60 9/9/2022
1.0.288-preview.151 51 9/8/2022
1.0.288-preview.118 78 8/6/2022
1.0.288-preview.113 63 8/4/2022
1.0.288-preview.83 89 7/13/2022
1.0.288-preview.65 63 7/6/2022
1.0.288-preview.40 62 6/24/2022
1.0.288-preview.37 60 6/23/2022
1.0.288-preview.21 76 6/13/2022
1.0.288-preview.3 65 6/2/2022
1.0.288-preview.1 67 6/1/2022