DaveC5 Newbie Joined: 24/09/2025 Location: United KingdomPosts: 25
Posted: 10:14am 18 Feb 2026
Copy link to clipboard
Print this post
Just tried the new LCD commands with the LCD interface in the Pi-PicoBuddy board. Works a treat out of the box and saves a load of extra programming. Sets up with: I2CLCD INIT &H3E Lovely stuff Peter! matherp said It has somehow gone missing from the manual Quote I2CLCD Command Purpose: Controls HD44780-compatible character LCD displays via a PCF8574 I2C I/O expander module. These adapter modules are commonly found as daughter boards on 16x2 and 20x4 character LCDs, providing I2C control using only two wires (plus power). Syntax: I2CLCD INIT address I2CLCD CLOSE I2CLCD CLEAR I2CLCD BACKLIGHT state I2CLCD CURSOR state [, BLINK] I2CLCD CREATECHAR code, d0, d1, d2, d3, d4, d5, d6, d7 I2CLCD CMD byte [, byte ...] I2CLCD DATA byte [, byte ...] I2CLCD line, position, string$ I2CLCD line, Cn, string$ Description: Subcommand Description INIT address Initialize the LCD at the specified I2C address. The address is typically &H27 or &H3F for most modules. PCF8574 uses &H20-&H27, PCF8574A uses &H38-&H3F. Requires OPTION SYSTEM I2C to be configured first. A degree symbol (°) is automatically created at character code 0. CLOSE Close the LCD and turn off the backlight. CLEAR Clear the display and return cursor to home position. BACKLIGHT state Turn the backlight on (1) or off (0). CURSOR state [, BLINK] Control cursor visibility. State can be ON/OFF or 1/0. Optional BLINK parameter (or 1) enables cursor blinking. CREATECHAR code, d0-d7 Define a custom character at code (0-7). The 8 data bytes (d0-d7) define the 5x8 pixel pattern, with each byte representing one row (values 0-31, only lower 5 bits used). CMD byte [, byte ...] Send raw command byte(s) directly to the LCD controller. DATA byte [, byte ...] Send raw data byte(s) directly to the LCD controller. line, position, string$ Display text on line (1-4) starting at position (1-40). line, Cn, string$ Display centered text on line (1-4). Cn specifies display width: C8, C16, C20, or C40. Hardware Configuration: The PCF8574 I/O expander must be wired to the LCD using the standard configuration: P0 = RS (Register Select) P1 = RW (Read/Write) P2 = EN (Enable) P3 = Backlight control P4 = D4 P5 = D5 P6 = D6 P7 = D7 This is the default wiring used by virtually all LCD I2C backpack modules. Prerequisites: The SYSTEM I2C interface must be configured before using this command: OPTION SYSTEM I2C sda_pin, scl_pin