Skip to content

BTHQ21605V_lcd_init

gicking edited this page Feb 8, 2018 · 2 revisions

back to Command Reference / LCD-BTHQ21605V-I2C

Description

Resets the I2C LCD display via (high active) reset pin and clears it for output.

Notes:

  • only checked for 2x16 LCD Batron BTHQ21605V-COG-FSRE-I2C (Farnell 1220409).

Inclusion

  • defined in mub_lcd.h
  • not loaded by main_general.h
  • no #define required
  • a custom I2C address can be set using #define in config.h

Syntax

BTHQ21605V_lcd_init(pPort, pin)

Parameters

  • input:

    • pPort: address of port for reset, e.g. &PORT_A
    • pin: pin you wish to set (0..7)
  • output:

    • none

Returns

  • 1: LCD found / 0: no LCD attached

Example Code

The below code periodically blinks "hello world" to the LCD.

#include "main_general.h"   // board-independent main
#include "lcd-BTHQ21605V.h"

void setup()
{
  // init I2C module 
  i2c_init();

  // init and reset LCD display
  BTHQ21605V_lcd_init(&PORT_E, 3);

}

void loop()
{
  // print to LCD
  BTHQ21605V_lcd_print(1, 1, "hello");
  BTHQ21605V_lcd_print(2, 1, "world");
  
  // wait a bit
  delay(500);
  
  // clear LCD display
  BTHQ21605V_lcd_clear();
  
  // wait a bit
  delay(500);

}

Relevant Tutorial

See also

Clone this wiki locally