8 years, 11 months ago.

How to use lcd with i2c in kl25z platform?

How I can do to make the 16x2 LCD display, it displays text in kl25z? ¿como puedo hacer que en un display lcd de 16x2 muestre texto usando el protocolo i2c?

for example, if I did not use i2c, TextLCD would have to use the library and declare the pins, and the main, put the line of text.

TextLCD lcd (pin)

lcd.printf ("text");

But how then to use i2c, and print text on the LCD display?

this is the display you use, and the i2c interface.

please some example easy

español

por ejemplo, si yo no usara i2c, tendria que usar la libreria TextLCD y declarar los pines, y en el main, poner la linea de texto.

TextLCD lcd(pines)

lcd.printf("texto");

pero, ¿como haga para usar i2c, e imprimir texto en el display lcd?

este es el display que uso, y el la interfaz i2c.

porfa un ejemplo fácil

/media/uploads/geargreen/img_0114.jpg

/media/uploads/geargreen/img_0113.jpg

1 Answer

8 years, 11 months ago.

The display you have is a regular character LCD with an I2C portexpander attached. The TextLCD Enhanced library has support for this type of I2C portexpanders. See https://developer.mbed.org/components/HD44780/. There are several types of portexpanders available that sometimes have different pinouts. In your case you should select YFROBOT type. Modify the code in TextLCD_config.h as follows:

//Pin Defines for I2C PCF8574/PCF8574A or MCP23008 and SPI 74595 bus expander interfaces
//Different commercially available LCD portexpanders use different wiring conventions.
//LCD and serial portexpanders should be wired according to the tables below.
//
//Select Serial Port Expander Hardware module (one option only)
#define DEFAULT     0
#define ADAFRUIT    0
#define DFROBOT    0
#define YWROBOT   1
#define GYLCD       0
#define SYDZ          0

The example code TextLCD_HelloWorld2 on the component page should be modified to use the correct pins for I2C on the KL25Z.

More details on how to connect the display and use the library is here.