nanoFramework.Iot.Device.CharacterLcd 1.0.288-preview.1

Prefix Reserved
This is a prerelease version of nanoFramework.Iot.Device.CharacterLcd.
There is a newer version of this package available.
See the version list below for details.
dotnet add package nanoFramework.Iot.Device.CharacterLcd --version 1.0.288-preview.1
                    
NuGet\Install-Package nanoFramework.Iot.Device.CharacterLcd -Version 1.0.288-preview.1
                    
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.0.288-preview.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="nanoFramework.Iot.Device.CharacterLcd" Version="1.0.288-preview.1" />
                    
Directory.Packages.props
<PackageReference Include="nanoFramework.Iot.Device.CharacterLcd" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add nanoFramework.Iot.Device.CharacterLcd --version 1.0.288-preview.1
                    
#r "nuget: nanoFramework.Iot.Device.CharacterLcd, 1.0.288-preview.1"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package nanoFramework.Iot.Device.CharacterLcd@1.0.288-preview.1
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=nanoFramework.Iot.Device.CharacterLcd&version=1.0.288-preview.1&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=nanoFramework.Iot.Device.CharacterLcd&version=1.0.288-preview.1&prerelease
                    
Install as a Cake Tool

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:

```csharp
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

```csharp
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](https://github.com/dotnet/iot/tree/main/src/devices/ShiftRegister/README.md) binding in order to drive an HD44780 display using a shift register. The [ShiftRegister](https://github.com/dotnet/iot/tree/main/src/devices/ShiftRegister/README.md) 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:

```csharp
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](https://learn.adafruit.com/i2c-spi-lcd-backpack) which uses the [Sn74hc595](https://github.com/dotnet/iot/blob/main/src/devices/Sn74hc595/README.md) 8-bit shift register to support SPI communication. The pin parameters are set according to the backpack's [schematic](https://learn.adafruit.com/i2c-spi-lcd-backpack/downloads).

## Character LCD display Samples

[Different samples](https://github.com/nanoframework/tree/main/src/devices/CharacterLcd/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.


### Sample wiring

![wiring](lcmWiringExample.jpg)
Product Compatible and additional computed target framework versions.
.NET Framework net is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
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

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

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.1.801 1,011 4/28/2025
1.1.789 442 4/7/2025
1.1.785 294 4/2/2025
1.1.772 373 3/12/2025
1.1.770 311 3/11/2025
1.1.760 377 3/5/2025
1.1.756 195 3/3/2025
1.1.750 431 2/27/2025
1.1.747 232 2/27/2025
1.1.738 316 2/26/2025
1.1.735 190 2/26/2025
1.1.708 345 2/5/2025
1.1.700 255 2/4/2025
1.1.698 249 2/4/2025
1.1.692 246 2/4/2025
1.1.689 244 2/4/2025
1.1.685 244 2/3/2025
1.1.680 263 2/1/2025
1.1.677 267 1/31/2025
1.1.647 453 1/8/2025
1.1.636 291 12/30/2024
1.1.622 307 12/18/2024
1.1.614 252 12/16/2024
1.1.609 261 12/11/2024
1.1.591 470 10/23/2024
1.1.583 280 10/16/2024
1.1.580 291 10/11/2024
1.1.569 304 9/27/2024
1.1.553 369 8/30/2024
1.1.513 625 7/24/2024
1.1.507 321 7/12/2024
1.1.498 331 6/28/2024
1.1.478 436 5/29/2024
1.1.466 336 5/15/2024
1.1.463 222 5/10/2024
1.1.449 506 4/12/2024
1.1.442 230 4/9/2024
1.1.439 220 4/5/2024
1.1.364 1,300 11/17/2023
1.1.354 329 11/10/2023
1.1.246 1,871 5/24/2023
1.1.226 442 5/11/2023
1.1.223 274 5/10/2023
1.1.221 284 5/10/2023
1.1.216 452 5/3/2023
1.1.192 717 3/17/2023
1.1.131 1,668 1/5/2023
1.1.127 791 1/3/2023
1.1.122 1,183 12/28/2022
1.1.82 1,015 11/16/2022
1.1.78 710 11/14/2022
1.1.72 983 11/5/2022
1.1.60 806 10/25/2022
1.1.47 762 10/22/2022
1.1.41 1,166 10/12/2022
1.1.37 869 10/11/2022
1.1.33 1,098 10/8/2022
1.1.27 826 10/7/2022
1.1.23 1,178 9/24/2022
1.1.14 1,496 9/22/2022
1.1.8 604 9/16/2022
1.1.6 639 9/15/2022
1.1.1 627 9/14/2022
1.0.288-preview.155 242 9/9/2022
1.0.288-preview.151 193 9/8/2022
1.0.288-preview.118 256 8/6/2022
1.0.288-preview.113 211 8/4/2022
1.0.288-preview.83 242 7/13/2022
1.0.288-preview.65 222 7/6/2022
1.0.288-preview.40 239 6/24/2022
1.0.288-preview.37 227 6/23/2022
1.0.288-preview.21 242 6/13/2022
1.0.288-preview.3 236 6/2/2022
1.0.288-preview.1 223 6/1/2022