chipKIT® Development Platform

Inspired by Arduino™

Problem with LCD16x02 by I2C module

Created Sat, 06 Apr 2013 13:23:09 +0000 by ermes


ermes

Sat, 06 Apr 2013 13:23:09 +0000

Hello everyone! I have a problem with chipKIT uc32.

With original Arduino Uno and original Arduino 1.0.4 software I have connected the LCD16x2 (QC1602A v2 HD44780) by mjkdz I2C module (IIC/I2C/TWI/SP??I Serial Interface Board Module) at Arduino Uno (PIN 5V/GND/A4 SDA/A5 SCL). I used the LiquidCrystal_I2C.h library for Arduino 1.0, downloaded at following web site http://garagelab.com/profiles/blogs/tutorial-lcd-using-only-2-arduino-pins-with-pcf8574-and-i2c. I loaded the 'hello world' example and the display correctly works with I2C module.

I performed the same tasks using mpide program, the LiquidCrystal_I2C.h was loaded at mpide-0023/libraries and mpide-0023/hardware/pic32/libraries. By 'verify' button there were obtained the following results:

chipKIT uc32 board

In file included from HelloWorld.cpp:2:0: D:\Portable\PortableApps\mpide-0023.\hardware\pic32\libraries\LiquidCrystal_I2C/LiquidCrystal_I2C.h:82:18: error: conflicting return type specified for 'virtual size_t LiquidCrystal_I2C::write(uint8_t)' D:\Portable\PortableApps\mpide-0023\hardware\pic32\cores\pic32/Print.h:50:15: error: overriding 'virtual void Print::write(uint8_t)'

Arduino Uno board

In file included from HelloWorld.cpp:2: D:\Portable\PortableApps\mpide-0023.\libraries\LiquidCrystal_I2C/LiquidCrystal_I2C.h:82: error: conflicting return type specified for 'virtual size_t LiquidCrystal_I2C::write(uint8_t)' D:\Portable\PortableApps\mpide-0023\hardware\arduino\cores\arduino/Print.h:40: error: overriding 'virtual void Print::write(uint8_t)'

how can I get the chipKIT uc32 by LCD16X2 the I2C module?

Best regards


majenko

Sat, 06 Apr 2013 13:34:33 +0000

First step: edit the library so that all definitions of "size_t ...::write(...)" have the initial size_t replaced with void.

Then see what the next error is it gives you.


ermes

Sat, 06 Apr 2013 13:57:57 +0000

Thanks for the help

On LiquidCrystal_I2C.cpp file the inline size_t LiquidCrystal_I2C::write(uint8_t value) { was replace with inline void LiquidCrystal_I2C::write(uint8_t value) {

on LiquidCrystal_I2C.h file the virtual size_t write(uint8_t); was replace with virtual void write(uint8_t);

naw, I have the following error:

D:\Portable\PortableApps\mpide-0023.\hardware\pic32\libraries\LiquidCrystal_I2C\LiquidCrystal_I2C.cpp:6:21: fatal error: Arduino.h: No such file or directory compilation terminated.

On Arduino 1.0.4 installation, I have 3 file 'Arduino.h'

D:\Portable\PortableApps\arduino-1.0.4\hardware\arduino\firmwares\wifishield\wifi_dnld\src\SOFTWARE_FRAMEWORK\BOARDS\ARDUINO D:\Portable\PortableApps\arduino-1.0.4\hardware\arduino\firmwares\wifishield\wifiHD\src\SOFTWARE_FRAMEWORK\BOARDS\ARDUINO D:\Portable\PortableApps\arduino-1.0.4\hardware\arduino\cores\arduino


majenko

Sat, 06 Apr 2013 16:48:46 +0000

Replace Arduno.h with WProgram.h


ermes

Sun, 07 Apr 2013 10:11:17 +0000

On LiquidCrystal_I2C.cpp file the #include "Arduino.h" was replace with #include "WProgram.h"

now, I have the following error:

D:\Portable\PortableApps\mpide-0023.\libraries\LiquidCrystal_I2C\LiquidCrystal_I2C.cpp: In member function 'virtual void LiquidCrystal_I2C::write(uint8_t)': D:\Portable\PortableApps\mpide-0023.\libraries\LiquidCrystal_I2C\LiquidCrystal_I2C.cpp:221: error: return-statement with a value, in function returning 'void' D:\Portable\PortableApps\mpide-0023.\libraries\LiquidCrystal_I2C\LiquidCrystal_I2C.cpp: In member function 'void LiquidCrystal_I2C::expanderWrite(uint8_t)': D:\Portable\PortableApps\mpide-0023.\libraries\LiquidCrystal_I2C\LiquidCrystal_I2C.cpp:243: error: 'class TwoWire' has no member named 'write'


majenko

Sun, 07 Apr 2013 10:30:33 +0000

Don't you just love how the Arduino folks made so many sweeping changes for little or no benefit?

I believe that the Arduino I2C code switched from using .send() to using .write() in 1.0.0, so change the .write calls to .send. Also, remove the return commands from the .write() function you have recently modified to be void.


ermes

Wed, 17 Apr 2013 22:14:22 +0000

Thanks for help me.

Since the last modified file I added the following changes

On LiquidCrystal_I2C.h file the void send(uint8_t, uint8_t); was replace with void write(uint8_t, uint8_t);

On LiquidCrystal_I2C.cpp file the send(value, 0); was replace with write(value, 0);

On LiquidCrystal_I2C.cpp file the send(value, Rs); was replace with write(value, Rs);

On LiquidCrystal_I2C.cpp file the

void LiquidCrystal_I2C::send(uint8_t value, uint8_t mode) { uint8_t highnib=value>>4; uint8_t lownib=value & 0x0F; write4bits((highnib)|mode); write4bits((lownib)|mode); }

was replace with

void LiquidCrystal_I2C::write(uint8_t value, uint8_t mode) { uint8_t highnib=value>>4; uint8_t lownib=value & 0x0F; write4bits((highnib)|mode); write4bits((lownib)|mode); }

now I have the following errors:

D:\Portable\PortableApps\mpide-0023.\hardware\pic32\libraries\LiquidCrystal_I2C\LiquidCrystal_I2C.cpp: In member function 'virtual void LiquidCrystal_I2C::write(uint8_t)': D:\Portable\PortableApps\mpide-0023.\hardware\pic32\libraries\LiquidCrystal_I2C\LiquidCrystal_I2C.cpp:221:9: error: return-statement with a value, in function returning 'void' D:\Portable\PortableApps\mpide-0023.\hardware\pic32\libraries\LiquidCrystal_I2C\LiquidCrystal_I2C.cpp: In member function 'void LiquidCrystal_I2C::expanderWrite(uint8_t)': D:\Portable\PortableApps\mpide-0023.\hardware\pic32\libraries\LiquidCrystal_I2C\LiquidCrystal_I2C.cpp:243:7: error: 'class TwoWire' has no member named 'write'

Best Regards