#picaxe 18m2
init:
i2cslave 27,i2cslow,i2cword ' set up i2cslave for LCD
pause 500 ' wait for display to initialise
writei2c 0,(254,1) ; clear screen
pause 200
writei2c 0,("Hello World",255);
pause 200
See technical's post:I have used this code:
Nothing happens...Code:#picaxe 18m2 init: i2cslave 27,i2cslow,i2cword ' set up i2cslave for LCD pause 500 ' wait for display to initialise writei2c 0,(254,1) ; clear screen pause 200 writei2c 0,("Hello World",255); pause 200
As the i2c I/O expander only has eight I/O pins, the LCD will be controlled using the 4-bit interface and you have to send two bytes to pulse the Enable pin. This would be quite slow, very difficult to use, program memory hogging and generally not very good.The board has a PCF8574 i2c i/o expander on it.
This is a 'dumb' i2c-parallel chip with none of the intelligence of other more common serial LCD modules.
So basically you have to work out which on the 8 i/o pins are connected to which LCD pin and then completely hard code all the LCD control codes / initialisation routines.
That can be done, but all in all it would probably be much simpler to buy an 'intelligent' i2c or serial module like the AXE033 or AXE133.
No. Only communications to the i2c port expander to control the LCD are. However you must first find out which pins on the port expander's port connect where on the LCD.Do I have to split address 27 to two part too?
I can't believe it's that complicated...
#picaxe 18m2
init:
i2cslave 27,i2cslow,i2cbyte ' set up i2cslave for LCD
pause 500 ' wait for display to initialise
hi2cout 0,(0,3)
pause 10
hi2cout 0,(0,3)
pause 10
hi2cout 0,(0,3)
pause 200
hi2cout 0,(0,3)
pause 20
hi2cout 0,(8,0)
pause 20
hi2cout 0,(1,0)
pause 20
hi2cout 0,(6,0)
#picaxe 18m2
init:
i2cslave 27,i2cslow,i2cbyte ' set up i2cslave for LCD
pause 500 ' wait for display to initialise
hi2cout 27,($30)
pause 10
hi2cout 27,($30)
pause 10
hi2cout 27,($30)
pause 200
hi2cout 27,($30)
pause 20
hi2cout 27,($8)
pause 20
hi2cout 27,($1)
pause 200
hi2cout 27,($4)
pause 200
hi2cout 27,("Hello World");
pause 200
Very probably, but it's worth looking at the AXE134Y 20x4 OLED which seems comparably priced to what you have. It will be very much easier to interface to using serial.Could AXE132 drive this LCD?
Symbol bitD0 = bit8
Symbol bitD1 = bit9
Symbol bitD2 = bit10
Symbol bitD3 = bit11
Symbol bitRS = bit12
Symbol bitE = bit13
SendB0AsCommandByte:
bitRS = 0
SendB0AsDataByte:
bitD0 = bit4 ; Send msb first
bitD1 = bit5
bitD2 = bit6
bitD3 = bit7
bitE = 1
b2 = b1 ; b2 holds msb with E set
bitE = 0 ; b1 holds msb with E clear
HI2cOut b1, ( b2, b1 )
bitD0 = bit0 ; Send lsb second
bitD1 = bit1
bitD2 = bit2
bitD3 = bit3
bitE = 1
b2 = b1 ; b2 holds lsb with E set
bitE = 0 ; b1 holds lsb with E clear
HI2cOut b1, ( b2, b1 )
bitRS = 1 ; Send data byte next time
Return
No, you need to determine what the PCF8574 signal connections are to the LCD, need to work out which bits control which LCD signal. Without that you won't likely be going anywhere.Maybe next I need to learn how to clear display.
Yes, but still it doesnt light when that code is working. In start it will flash but go off when program starts.Isn't the LED controlled manually by the jumper link on the back?
HI2cSetup I2CMASTER, $4E, I2CSLOW, I2CBYTE
b0 = $33 : Gosub SendB0AsInitByte 'LED will go off in this line of code.
Does the backlight come on if you use b0 = $3B ? If yes, then that means that P3 is actually connected to a transistor that controls the backlight.Yes, but still it doesnt light when that code is working. In start it will flash but go off when program starts.
Code:HI2cSetup I2CMASTER, $4E, I2CSLOW, I2CBYTE b0 = $33 : Gosub SendB0AsInitByte 'LED will go off in this line of code.
"It will not light with that" sounds like an assumption rather than fact. Did you actually try it?No, it will not light with that.
Ok. Is there a transistor controlling the backlight?Of course I have try it! How else I could say that?
Can you desolder the black board from the connector?There IS some transistor in the other side of LCM1602 IIC V1 -board but I don't know if it is controlling it and I can't measure it like I wrote.
I check the circuit:
LED controller is in the green board, not this little black board where that transistor is.
In green board aren't any transistor. There is these 5 IC and 8 resistors which must control backlight LEDs.