1

I am new to this forum and a relative beginner to Arduino (software wise) Have built many projects, but always just copy/paste/modify example code.

I found a couple of these modules (a PIC18 daughter board on the back of a common 16x2 LCD) It says in the data sheet that it can be controlled via I2C, but my skill level is too low to figure out how to do it. Can somebody please give me advice on how to proceed?

The "I2C Scanner" sketch identifies it at address 0x14 , but the usual I2C-LCD libraries don't work on it. I use it with an Arduino UNO, SDA(A4), SCL(A5), 1k8 pullup resistors on each. The module is working 100% with the 1 wire serial method as per the manual.

This is how I think it should work, but it does nothing:


// Include Arduino Wire library for I2C
#include <Wire.h>
 
// Define Slave I2C Address
#define SLAVE_ADDR 0x14   // 7bit address = 0010100D, 0x14 hex



void setup () {
  
 Wire.begin();                           // Initialize I2C communications as Master


  // Write something to the Slave
 Wire.beginTransmission(0x14);           //  0x14  (SLAVE_ADDR)  0010100
  Wire.write(0x28);                       //  00101000
  Wire.write(0x00);                      //  Register address  "0"
  Wire.write("A");                       //  some text
  Wire.endTransmission();

 }

void loop () {
 
}

Link to manual: http://www.i-lcd.com/PDFs/Drivers/Technical%20data%20on%20DS-LCDD5%20Interface%20Module%20(IDS).pdf

3
  • Try leaving out the Wire.write(0x28);.
    – Gerben
    Oct 26 at 16:13
  • If the leads are not long go to something in the 3.3 to 4.7K range. In my opinion there is a problem with the I2C libraries, they are not all compatible. I found one that works and I put it in the folder with my sketch. Since doing that I have nad no more I2C-LCD problems.
    – Gil
    Oct 27 at 0:38
  • Data sheet or firmware is wrong. See this for solution: <forum.arduino.cc/t/…> Thank you for all advice. Joe
    – Jdev99
    Oct 27 at 10:50
1

So, after I "remembered" that I have an oscilloscope, I hooked it up and noticed that I don't receive an "acknowledge" from the module.

Then I played around with the clock speed, and found I do get an "acknowledge" if I set it between 16000kHz and 18000kHz with the "Wire.setClock" command. :thinking:

Then by mere coincidence, I found that text must got to R1 NOT R0 and control commands to R2 NOT R1. :grimacing: But I could not get any of the RGB commands to work. I tried this on all 6 of the modules which I have, same results. I will just stick to serial comms when I need to use any of these.

So, either the datasheet is wrong or the firmware in the module is flawed. At least I learned a lot about the workings of I2C in the process, which my goal was.

https://forum.arduino.cc/t/need-help-with-i2c-code-for-a-16x2-lcd-ds-lcdd5/918289/28?u=jdev99

Thank you for all advice. Joe

Working code:

'''

// Include Arduino Wire library for I2C #include <Wire.h>

// Define Slave I2C Address #define SLAVE_ADDR 0x14 // 7bit address = 0010100D, 0x14h

void setup () {

Wire.begin(); // Initialize I2C communications as Master Wire.setClock(16000); // only 16000 - 18000 work

//Clear display Wire.beginTransmission(0x14); Wire.write(0x02); Wire.write(0x01); Wire.endTransmission();

}

void loop () {

//Start print on line1, pos1 Wire.beginTransmission(0x14); Wire.write(0x02); Wire.write(128); Wire.endTransmission();

// Write something to the Slave Wire.beginTransmission(0x14); // 0x14 (SLAVE_ADDR) 0010100 Wire.write(0x01); // Register address "0" Wire.write("ABCDEFGHIJKLMNOP"); // some text Wire.endTransmission();

delay(3000);

//Clear display Wire.beginTransmission(0x14); Wire.write(0x02); Wire.write(0x01); Wire.endTransmission();

//Start print on line2, pos1 Wire.beginTransmission(0x14); Wire.write(0x02); Wire.write(192); Wire.endTransmission();

// Write something to the Slave Wire.beginTransmission(0x14);
Wire.write(0x01);
Wire.write("1234567890-=+*/@");
Wire.endTransmission();

delay(3000);

//Clear display Wire.beginTransmission(0x14); Wire.write(0x02); Wire.write(0x01); Wire.endTransmission();

}

'''

0
0

Try Replacing the "A" to single quotes 'a' Wire.write('A'); or Wire.write(0x41);

you can also try and add (byte) before the hex value: Wire.write((byte)0x28);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.