Skip to content

YuShuanHsieh/lcd-2004a-i2c

Repository files navigation

Sample code for LCD 2004 via I2C

This is a sample code for displaying characters on LCD 2004A device via I2C protocol. This code is based on example code from pico-examples/lcd_1602_i2c and make some changes including:

  1. Separating the example code into different source files to make it more clear.
  2. Add struct lcd_device so that we can use different I2C pins instead of default one.
  3. Check LCD's I2C address is available before initializing it.
  4. Fix invalid memory access issues during displaying messages.

The reason why I create this repo is there are lots of sample code for LCD 1602 or 2004 device, but few of them describe how the sample code works. I will try to add some information to help user to understand the process of sample code.

Dependencies

  • pico SDK
  • CMake

Datasheet

  1. LCD 2004A datasheet
  2. I2C remote 8-bit I/O expander datasheet

Build

  1. Setup PICO_SDK_PATH environment variable
export PICO_SDK_PATH=~/pico/pico-sdk
  1. Create a build folder
mkdir build && cd build
  1. In build directory, run CMake to configure the project
# or cmake -DCMAKE_BUILD_TYPE=Debug ..
cmake ..
  1. Build an executable file
make

About

A sample code for displaying characters on LCD 2004A device via I2C protocol

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published