DesignSpark Electrical Logolinkedin
  • Brought to you by
  • RS Components
  • Allied Electronics

March 16, 2017 17:19

Follow

Adding a C++ LCD Display Driver to the IOT2020

The Hitachi type LCD displays are used in many designs. They work with an Arduino sketch on the IOT2020. If you're building a C++ project, this driver class can help.

 

 

 

 

 

 

 

 

 

 

 

 

The full source code is attached. It contains an example that uses the SainSmart LCD shield - because I happen to have that one. It works with the typical one and two row LCD displays. Check that the pins you're passing to the init() method match the ones of your design. If you are able to use your display on the Arduino UNO, use the same pin numbers here (I don't use the RW pin, so no need to pass that one).

Methods 

void init( uint32_t u_rs, uint32_t u_enable, uint32_t u_d0,
uint32_t u_d1, uint32_t u_d2,
uint32_t u_d3)

void begin(uint32_t cols, uint32_t lines, uint32_t dotsize)

void setCursor(uint32_t col, uint32_t row)

void print(const std::string& input)

 

Example 

int main(void) {

  LCD* lcd = new LCD();

  lcd->init(8, 9, 4, 5, 6, 7);
  lcd->begin(16,2, 0);
  lcd->setCursor(0,0); // move to the beginning of the first line
  lcd->print("Hello, world!");
  delete lcd;
  return 0;
}

 

The library that is used as the inspiration for this work has the following licence (full version in the attached source). Please adhere to that:

GNU Lesser General Public License
Copyright (C) 2006-2008 Hans-Christoph Steiner. All rights reserved.
Copyright (c) 2010 Arduino LLC. All right reserved.

Have fun!

Downloads

industrial automotive medical electronics

March 16, 2017 17:19

Follow