Code: Select all
pinout is as follows: PCF8574 - HD44780
P0 - LCD11 - D4
P1 - LCD12 - D5
P2 - LCD13 - D6
P3 - LCD14 - D7
P4 - LCD4 - RS
P5 - LCD5 - R/W
P6 - LCD6 - E
P7 - LCD15 - LED BACKLIGHT
Code: Select all
void LCD_initialize(void)
{
RES=0;
Delay(200);
RES=1;
Delay(200);
Start();
SentByte(Write_Address); //slave addresses with write
SentByte(0x80); //Continuation bit command
SentByte(0x2a); //RE=1
... etc
Code: Select all
#!/usr/bin/python
import smbus
import time
bus = smbus.SMBus(0)
address = 0x3C
bus.write_byte_data(address,0x80,0x2A) # // **** Set "RE"=1<--->00101010B
bus.write_byte_data(address,0x80,0x71) # Function Selection A [71h] (IS = X, RE = 1, SD=0), 2bajty
bus.write_byte_data(address,0xc0,0x00) # 0x5C set Vdd
bus.write_byte_data(address,0x80,0x28)
bus.write_byte_data(address,0x80,0x08) #// **** Set Sleep Mode On
bus.write_byte_data(address,0x80,0x2A) #// **** Set "RE"=1 00101010B
bus.write_byte_data(address,0x80,0x79) #// **** Set "SD"=1 01111001B
bus.write_byte_data(address,0x80,0xD5) # Set Display Clock Divide Ratio/ Oscillator Frequency (D5h
bus.write_byte_data(address,0x80,0x70)
bus.write_byte_data(address,0x80,0x78) #// **** Set "SD"=0
bus.write_byte_data(address,0x80,0x08) #// **** Set Dispmode, 5-dot, 3 or 4 line(0x09), 1 or 2 line(0x08)
bus.write_byte_data(address,0x80,0x06) #// **** Set Com31-->Com0 Seg0-->Seg99
#// **** Select Character ROM *** //
bus.write_byte_data(address,0x80,0x72) #// **** Set ROM
bus.write_byte_data(address,0xc0,0x01) #// **** Set ROM A and 8 CGRAM
#**** Entering Set OLED Characterization
bus.write_byte_data(address,0x80,0x2A) #// **** Set "RE"=1
bus.write_byte_data(address,0x80,0x79) #// **** Set "SD"=1
#// **** CGROM/CGRAM Management*** //
bus.write_byte_data(address,0x80,0xDA) #// **** Set Seg Pins HW Config
bus.write_byte_data(address,0x80,0x10)
bus.write_byte_data(address,0x80,0xDC) #// **** Set Segment Low Voltage and GPIO
bus.write_byte_data(address,0x80,0x00)
bus.write_byte_data(address,0x80,0x81) #// **** Set Contrast
bus.write_byte_data(address,0x80,0x8F)
bus.write_byte_data(address,0x80,0xD9) #// **** Set Phase lenght
bus.write_byte_data(address,0x80,0xF1)
bus.write_byte_data(address,0x80,0xDB) #// **** Set VCOM deselect level
bus.write_byte_data(address,0x80,0x30) #// **** VCC x 0.83
bus.write_byte_data(address,0x80,0x78) #// **** Exiting Set OLED Characterization
bus.write_byte_data(address,0x80,0x28) #// **** Set "IS"=0 , "RE" =0 //28
bus.write_byte_data(address,0x80,0x01)
bus.write_byte_data(address,0x80,0x80) #// **** Set DDRAM Address to 0x80 (line 1 start)
time.sleep (0.1)
bus.write_byte_data(address,0x80,0x0C) #// **** Turn on Display
bus.write_i2c_block_data(address,0x40,[32,32,ord('i'),ord('n'),ord('i'),ord('t'),ord('.'),ord('.')])
0xFF wrote:Nice screen
Oh, thanks, I will try to get it running next week. Was just about to ask whats next,0xFF wrote:For fun with XBMC, you need to download lcdproc sources from http://www.lcdproc.org/ and patch hd44780-i2c.c file
like I did here: https://github.com/0xFACE/RPi-OLED-Disp ... 4780-i2c.c
I'm not good coder, so it is just dirty hack for hdd44780-i2c driver.
Build sources, copy hd44780.so file to /usr/lib/lcdproc (overwrite original file) , setup /etc/LCDd.conf and .xbmc/userdataLCD.xml, install lcdproc plugin for xbmc.
Now start your favorite music/video and enjoy your brand new display
No, that's no problem.1958 wrote:
Oh, thanks, I will try to get it running next week. Was just about to ask whats next,
does it matter that I have lcdproc plugin all ready installed?
Should be fine.1958 wrote: Can I just overwrite the hd44780.so with patched version and set userdataLCD.xml and LCDd.conf to match my display?
Code: Select all
[email protected] ~ $ LCDd
Could not open driver module /usr/lib/lcdproc/hd44780.so: /usr/lib/lcdproc/hd44780.so: wrong ELF class: ELFCLASS64
Driver [hd44780] binding failed
Could not load driver hd44780
There is no output driver
Critical error while initializing, abort.
Code: Select all
bus.write_byte_data(address,0x80,0x71) # Function Selection A [71h] (IS = X, RE = 1, SD=0), 2bajty
bus.write_byte_data(address,0xc0,0x00) # 0x00 set Vdd
Code: Select all
data[1] = 0x71; //# Function Selection A [71h] (IS = X, RE = 1, SD=0;, 2bajty
i2c_out(p, data);
data[2] = 0x00; // 0x00 set Vdd
Oops, I did compile the driver on my desktop.. will do it again with the pi tomorrow..0xFF wrote:No idea. Was the driver cross-compiled on 64bit system?
Code: Select all
Hello="12345678901234567890"
Hello="09876543210987654321"
Hello="ABCDEFGHIJKLMNOPQRST"
Hello="abcdefghijklmnopqrst"
Code: Select all
12345678901234567890
MNOPQRSTIJKL
09876543210987654321
mnopqrstijkl
Code: Select all
void OLedI2C::cursPos(uint8_t col, uint8_t row)
{
int row_offsets[] = { 0x00, 0x20, 0x40, 0x60 };
sendCommand(0x80 | (col + row_offsets[row]));
Code: Select all
#
Specifies the size of the LCD.
# In case of multiple combined displays, this should be the total size.
Size=20x4
Code: Select all
ExtendedMode=yes
Wow!0xFF wrote:Try setting:Code: Select all
ExtendedMode=yes