Let's Make Robots!

Arduino and I2C LCD

(cross posting with arduino forum.. no answers there :(( )

hello! I have a picaxe LCD which support I2C and serial communication. You can see it here, datasheet here
 
Now i'm trying to use my Arduino Diecimila to display something, using i2c, but the LCD is not working.
Some stuff i've observed:
- the LCD works correctly with a picaxe board, always with i2c.
- with arduino, the board works ok in "clock" mode (a mode that doesn't communicate with the board but just show the current time).
- putting some debug println in the code, i can see that the program blocks in the Wire.endTransmission(); instruction.

 The code i'm using is:


#include <Wire.h>

// C6 63 46
byte addr = 0x63;

void setup()
{

Serial.begin(9600);

Serial.println("Init");

delay(500);
Wire.begin(); // join i2c bus (address optional for master)
delay(500);
}

void loop()
{
Serial.println(addr, HEX);
Wire.beginTransmission(addr);
Serial.println("A");
Wire.send(0);
Wire.send(254);
Wire.send(128);
Wire.send(255);
Serial.println("B");
Wire.endTransmission();
Serial.println("C");
delay(20);

Wire.beginTransmission(addr);
Wire.send(0);
Wire.send("Hello");
Wire.send(255);

Wire.endTransmission(); // stop transmitting

delay(50000);

}



 
I have some doubt about the address i should write to. The LCD has an address of 0xC6 (as in the datasheet), but it is in 8 bits, while, if i have understood correctly, the arduino wants a 7 bit address.
I tryed the same with 0x63 (discarding the low bit) and 0x46 (discarding the high bit).
 
The original Picaxe code for reference is:


init: pause 500
i2cslave $C6,i2cslow,i2cbyte
main: writei2c 0,(254,128,255)
pause 10
writei2c 0,("Hello!123",255)
end

 
It includes a "i2cslave" command that setups the device, is it something i should translate in arduino? it looks like it's not necessary but who knows..
 
Any help is greatly appreciated Smiley

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Hi,

don't know if you're problem has been solved.

Is the LCD module correct connected to the arduino board? (Analog In 4 -> SDA, Analog In 5 -> SCL)

Did you use pull-up resistors on the i2c lines? (4k7 resistors from SDA and SCL to VCC, see LCD manual section 2)

In my opinion 0x63 is the correct i2c address (0xC6>>1). One tip: do not put Serial.print Comands inside the i2c transmission:

All together it should look like:

void loop()
{
Serial.println(addr, HEX);
Serial.println("A");

Wire.beginTransmission(addr);
Wire.send(0);
Wire.send(254);
Wire.send(128);
Wire.send(255);
Wire.endTransmission();

Serial.println("B");
Serial.println("C");
delay(20);

Wire.beginTransmission(addr);
Wire.send(0);
Wire.send("Hello");
Wire.send(255);
Wire.endTransmission(); // stop transmitting

delay(50000);

}

Regards Peter

Thanks, i had already solved the problem. Basically it's not about the code, there's an issue with the libraries on linux that prevent i2c from working.

The very same program works on windows.