I2C

du1mga

New Member
Hi,
I like to connect an IIC/I2C/TWI 1602 LCD-Display to my 20M02 PICAXE. I have some problems with the I2C code.
The I2C adr. is 0X27 and the display is 16x2. It is very popular in eBay. The with this Display delivered driver for arduino is also not working with an atmega 2560!!.

Hopefully some one has had this problem before, was able to make a driver for the 20M02.

Regards
du1mga
 

nick12ab

Senior Member
This is an LCD with i2c address $27. However it isn't stated whether this address is 7-bit or 8-bit, and PICAXE uses 8-bit. If the LCD doesn't respond to the PICAXE at all, you should try using $4E as the address on PICAXE. Also make sure the LCD power and ground connections are connected to the PICAXE circuit.
 

inglewoodpete

Senior Member
This is an LCD with i2c address $27. However it isn't stated whether this address is 7-bit or 8-bit, and PICAXE uses 8-bit. If the LCD doesn't respond to the PICAXE at all, you should try using $4E as the address on PICAXE. Also make sure the LCD power and ground connections are connected to the PICAXE circuit.
du1mga, To explain what Nick is referring to: PICAXE formats the slave address to match what is used in the actual i2c signalling.

Address $27 is %00100111 but i2c signalling uses the lowest bit (bit 0) to indicate a read or write command. So the PICAXE 'shifts' the address byte up by one bit to free up bit 0. This results in the address %00100111 becoming %01001110 or $4E that Nick refers to.
 

SAborn

Senior Member
I received one of the I2C boards for the LCD yesterday myself, and its a Chinese puzzle trying to work out how to drive it.

There is very little information or data on the functions and i still have not managed to initialize the display as yet.

The download file for the board is next to useless and is in a file format i can not open, the makers web site is in Chinese and just wants to sell you a robot.

The only part helpfull page of information is attached below from some Ardunio code that show the hex codes used, now just need to work out how to use them in picaxe.


View attachment LiquidCrystal_I2C.pdf
 

du1mga

New Member
Hi all,
thanks for the fast response. I learned my lesson to late. Anyhow I'm not alone anymore. I have to monitor the work of SAborn. He has the same problem. Of course I will try to use at least parts of the LiquidCrystal_I2C.pdf.

Regards to all. I hope I can tell some positives soon.

Regards du1mga
 

SAborn

Senior Member
Please post any progress you make with the display, i see there is a few old threads to these boards on the forum but none give any information or even imply that anyone has got the board to work with picaxe.

One hint to remember that i have had with other I2C to LCD boards is .... after a program download its often needed to power down the circuit and power it back up again before the LCD will function, i have no idea if this applies with this board but worth a try between program changes.

In the PDF there is some code for the Enable, Register select , Read Write pins that will need to be used i think to set the display into instruction mode or character mode, but i still have not figured out how as yet.

Code:
#define En B00000100  // Enable bit
#define Rw B00000010  // Read/Write bit
#define Rs B00000001  // Register select bit
It might be a few days before i have time to crack this nut, although any input from other members could well be very helpful.
 

inglewoodpete

Senior Member
A link to the actual vendor's website (ebay would be a starting point) would help.

Is the inteface board made by digole? If so, the following may help.
Code:
// Communication set up command

 * "SB":Baud (ascII bytes end with 0x00/0x0A/0x0D) -- set UART Baud Rate
 * "SI2CA":Address(1 byte <127) -- Set I2C address, default address is:0x27
 * "DC":1/0(1byte) -- set config display on/off, if set to 1, displayer will display current commucation setting when power on

// Text Function command

 * "CL": -- Clear screen--OK
 * "CS":1/0 (1 byte)-- Cursor on/off
 * "TP":x(1 byte) y(1 byte) -- set text position
 * "TT":string(bytes) end with 0x00/0x0A/0x0D -- display string under regular mode

// Graphic function command

 * "GP":x(1byte) y(1byte) -- set current graphic position
 * "DM":"C/!/~/&/|/^"(ASCII 1byte) -- set drawing mode--C="Copy",! and ~ = "Not", & = "And", | = "Or", ^ = "Xor"
 * "SC":1/0 (1byte) -- set draw color--only 1 and 0
 * "LN":x0(1byte) y0(1byte) x1(1byte) y2(1byte)--draw line from x0,y0 to x1,y1,set new pot to x1,y1
 * "LT":x(1byte) y(1byte) -- draw line from current pos to x,y
 * "CC":x(1byte) y(1byte) ratio(byte) -- draw circle at x,y with ratio
 * "DP":x(1byte) y(1byte) Color(1byte) -- draw a pixel--OK
 * "DR":x0(1byte) y0(1byte) x1(1byte) y2(1byte)--draw rectangle, top-left:x0,y0; right-bottom:x1,y1
 * "FR":x0(1byte) y0(1byte) x1(1byte) y2(1byte)--draw filled rectangle, top-left:x0,y0; right-bottom:x1,y1
 

SAborn

Senior Member
Westy,

I did see that thread and you might like to edit your post there to correct the address you listed as you have "%0101110 " and it should be "%01001110.

For some reason i can not get into ebay to find the product as i keep getting a "connection problem" so will try to list it later.
 

du1mga

New Member
Hi,
I'm overwelmed with the response. I also try how I can bring it to work. I'm only able to switch the background-light on and off.

What ever I try I was not able to bring only a single character to the display.
Here is the code I use.

symbol slaveaddress = $4E
hi2csetup i2cmaster, slaveaddress, i2cslow, i2cbyte
do
hi2cout (0)
pause 1000
hi2cout (8)
pause 1000
loop

This will switch the background color on and off and initialise one row in white.

Regards and thanks to all.

du1mga
 

Technical

Technical Support
Staff member
Your LCD is generally not initialised if only the top line lights up

Did you try this from the datasheet

hi2cout ("TTHello World!",$0d)

Their datasheet also made us laugh out loud:
...and you also need to spend some time to write code to drive it, in some case, you may need couple
of days to deal with it, and will give you a nightmale when changing to other display.
 

Attachments

Last edited:

SAborn

Senior Member
I was joking around, i had noticed the error a few days ago but as it was a old thread though no more of it, until you dragged it to surface.

It Happens!

(Pssst, i wont tell anyone but you spelt my name wrong above ;) )
 
Top