Go Down

Topic: 5V IIC/I2C/TWI LCD Module Adapter For Arduino from eBay (Read 18266 times) previous topic - next topic

duraiyuvaraj

I tried to interface cheap eBay I2C display module. I have tried with many libraries, finally succeed using the attachment in this topic. But the Hello world example prints only the character "H". I have not changed anything except the address. Any help would be grateful.
Thank and regards

cattledog

What arduino are you using, and with what version of the IDE?

Are you using the F Malpartida library?

bperrybap

I'm not exactly sure which library you are using or which IDE, but I'm guessing that you are using a new IDE like 1.6.6 or newer.
This version of the IDE looks at the return value of the write() function.
There are i2c lcd libraries out there that screwed up their code in their write() function.
In the older IDE's it didn't matter, but this is not the case on the very recent IDE.
The write() function is supposed to return the number of characters processed.
If it is less than what was requested, it is an error and further output is thrown away.
In those libraries that are screwed up, the write() function is being called with a single character, and the write() function is returning 0, which is an error telling the upper layers not to send any more characters. It should be responding with a 1 indicating that 1 character has been successfully processed.

The proper solution is to go fix the broken code down in the .cpp file of the library.
It may look something like this:
Code: [Select]
inline size_t LiquidCrystal_I2C::write(uint8_t value) {
 send(value, Rs);
 return 0;
}


Or it may be different depending on which library you have.
The important thing to note is that the write function needs to return 1 and not 0


Alternatively, you could drop back to an older IDE where the broken/incorrect library will work because the other Print class code doesn't check for the error status.

--- bill

duraiyuvaraj

What arduino are you using, and with what version of the IDE?

Are you using the F Malpartida library?
Sorry, I forgotten to mention. IDE is 1.6.6.

I tried  fmalpartida library "NewLiquidCrystal 1.3.4" . No success. In fact fmalpartida referred the below post for pointing out pin change .

The library I am using is :
Attachment available from the post Here


I am using Arduino UNO board

The i2c board is this one.



duraiyuvaraj

I'm not exactly sure which library you are using or which IDE, but I'm guessing that you are using a new IDE like 1.6.6 or newer.
This version of the IDE looks at the return value of the write() function.
There are i2c lcd libraries out there that screwed up their code in their write() function.
In the older IDE's it didn't matter, but this is not the case on the very recent IDE.


Bill, Excellent!
You are right. It works in IDE 1.0.

As per your suggestion, I changed the return value  to 1. Now the same library works fine in the new IDE.

I belive fmalpartida library "NewLiquidCrystal 1.3.4" supposed to be updated and should work. but did not work. I have posted details of i2c board just before replying to your post. Could you suggest something to use the library?
For me it seems little complex piece of work.


Thank you.

cattledog

Quote
I belive fmalpartida library "NewLiquidCrystal 1.3.4" supposed to be updated and should work. but did not work. I have posted details of i2c board just before replying to your post. Could you suggest something to use the library?
For me it seems little complex piece of work.
I don't think that using a modified(inverted) version of the Mario_H library is not a good solution for the long term. What if you need to replace the i2c adaptor? Using the F Malpartida library in conjunction with Bill Perry's i2cLCDguesser sketch to determine the constructor is robust and flexible.

I don't know why you had trouble with the F Malpartida library, but I would  encourage you to work through your issues and get on solid ground with transparent access to the proper "constructor" for all the adaptors which have shown up so far.

jnoz

Had the same problem, those those searching I had a funduino LCM1602. First problem solved, now to try and amend the fact it doesn't scroll!

bullecoureur

they have made the change but it still doesn't work for me
i am using the last IDE and the last version of Liquid_Crystal_I2C

bperrybap

they have made the change but it still doesn't work for me
i am using the last IDE and the last version of Liquid_Crystal_I2C
I have never heard of a library called: "Liquid_Crystal_I2C"

But since your issue is different from the original topic,
you should start your own thread, particuarly
since the issue for this thread, made by the OP, duraiyuvaraj, has been solved.

Don't clutter up this revolved thread, by asking for help on some other issue.

--- bill

Paul__B

Don't clutter up this revolved thread, by asking for help on some other issue.
What goes around comes around?

bperrybap

What goes around comes around?

I'm guessing Humor??

I made an unintentional "oops" typo... and meant "resolved" as the OPs issue had been resolved.
Although the typo was actually pretty funny given how often we are seeing i2c backpack issues lately.

szawus

This solves the problem. Use this library: https://github.com/marcoschwartz/LiquidCrystal_I2C

bperrybap

This solves the problem. Use this library: https://github.com/marcoschwartz/LiquidCrystal_I2C
The library you reference above will be the one you get when if you use the library manager and search for LiquidCrystal_I2C
That library is the one that had 1 character write() issue.
While it was updated to correct this bug in late 2015, Marco forget to retag it to make it available to the IDE library manager.
This was issue #7 in that library:
https://github.com/marcoschwartz/LiquidCrystal_I2C/issues/7
I nudged him to create a new release tag so that the IDE library manager would see it.
The library you get now from the IDE manager will have this write() bug fix in it.


--- bill

ltore123

I'm not exactly sure which library you are using or which IDE, but I'm guessing that you are using a new IDE like 1.6.6 or newer.
This version of the IDE looks at the return value of the write() function.
There are i2c lcd libraries out there that screwed up their code in their write() function.
In the older IDE's it didn't matter, but this is not the case on the very recent IDE.
The write() function is supposed to return the number of characters processed.
If it is less than what was requested, it is an error and further output is thrown away.
In those libraries that are screwed up, the write() function is being called with a single character, and the write() function is returning 0, which is an error telling the upper layers not to send any more characters. It should be responding with a 1 indicating that 1 character has been successfully processed.

The proper solution is to go fix the broken code down in the .cpp file of the library.
It may look something like this:
Code: [Select]
inline size_t LiquidCrystal_I2C::write(uint8_t value) {
 send(value, Rs);
 return 0;
}


Or it may be different depending on which library you have.
The important thing to note is that the write function needs to return 1 and not 0


Alternatively, you could drop back to an older IDE where the broken/incorrect library will work because the other Print class code doesn't check for the error status.

--- bill


bperrybap

ltore123,
What is your point with that quote above?
The LiquidCrystal_I2C library has been fixed and is currently available in the library manager.
So the issue has been fixed/solved. (see post #12 of this thread)

If you would like to try another library that has additional features and is a a bit faster,
you could try my hd44780 library.
It is available in the IDE library manager and can be installed in a just a few seconds from the IDE GUI using the IDE library manager.
You can read more about here:
https://github.com/duinoWitchery/hd44780
It includes a diagnostic sketch that will test the i2c lines and the LCD memory inside the LCD module.

The library will locate the backpack i2c address and auto detect the pin mappings between the PCF8574 chip and the hd44780 signal pins.

The i/o class for PCF8574 based backpacks is hd44780_I2Cexp and the diag sketch is called I2CexpDiag
--- bill


Go Up