https://github.com/extremq/lcd1602_i2c
A simple, I2C-based implementation of the 1602 LCD with I2C interface in C using the Raspberry Pi Pico SDK.
https://github.com/extremq/lcd1602_i2c
c pico pico-sdk
Last synced: 12 months ago
JSON representation
A simple, I2C-based implementation of the 1602 LCD with I2C interface in C using the Raspberry Pi Pico SDK.
- Host: GitHub
- URL: https://github.com/extremq/lcd1602_i2c
- Owner: extremq
- License: mit
- Created: 2022-10-19T22:19:13.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2023-12-31T10:30:28.000Z (over 2 years ago)
- Last Synced: 2025-06-27T13:07:30.395Z (12 months ago)
- Topics: c, pico, pico-sdk
- Language: C
- Homepage:
- Size: 28.3 KB
- Stars: 14
- Watchers: 1
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# lcd1602_i2c
A simple, lightning-fast and scalable I2C-based implementation of the HD44780U 1602 LCD with I2C interface in C using the Raspberry Pi Pico SDK.

# Features
- Very efficient
- Used the datasheet to provide minimal sleep times. On average, the display needs to sleep 160 microseconds for each command
- Sends only the minimum amount of bytes necessary.
- Can be used to control multiple HD44780U 1602 LCDs.
- Just create an LCD object and use its address for each call.
- For example `lcd_char(&lcd_1, 'a'); lcd_char(&lcd_2, 'b');`.
- Heavily documented code.
- Made sure to reference pages in the original datasheet.
- Explained functions, variables and protocol. (Had to reverse engineer popular libraries, literally no documentation is provided for the I2C interface)
# How to install the module (for beginners)
The minimal way of adding this module to your CMake project is by downloading the `lcd1602_i2c.c` and `lcd1602_i2c.h` files
and placing them in the same folder as your main source.
From there, you have to add the files inside `add_executable`. For example:
```cmake
add_executable(my_project
main.c
lcd1602_i2c.c
lcd1602_i2c.h
)
```
DO NOT FORGET to include `hardware_i2c` in your `target_link_libraries`.
```cmake
target_link_libraries(my_project hardware_i2c pico_stdlib)
```
# Usage
Check example.c for a complete showcase. Minimal example here:
```c
#include "lcd1602_i2c.h"
int main() {
/* Init my modules */
LCD my_lcd;
lcd_init(&my_lcd, 0x27, 4, 5, i2c0); // Check the pins on your Pico
char message[] = "Thanks extremq";
lcd_string(&my_lcd, message);
}
```