Shop OBEX P1 Docs P2 Docs Learn Events
SH1106 I2C Display usage help. — Parallax Forums

SH1106 I2C Display usage help.

Kraken767Kraken767 Posts: 5
edited 2014-10-25 11:39 in Learn with BlocklyProp
I bought a 1.3" display off amazon and am having trouble getting anything to show on it. I have the QuickStart and the IC driver for the display is the SH1106, but i cant figure out how to send the right commands to get something to show. I've tried sending the device address as write using the simplei2c lib, then a control byte set as last control byte and write to ram, then several bytes filled with a mix of 0xFF and 0x00's. I'm really at a loss even after a couple nights going over and over and over the datasheet. Id really appreciate it if someone could show me how to pick a pixel and make it work. My last test code is below. I did try setting the page address and columns, but honestly i have no idea what the x and y coordinates of say page 3 column 4 line 5 are or how they relate, so i probably did it wrong. The page concept is whats really throwing me off.
i2c bus;  i2c_open(&bus, 9, 8, 0);
  i2c_start(&bus);
  i2c_writeByte(&bus, 0x78);//device address, write
  i2c_writeByte(&bus, 0x40);//control byte, last control byte, ram
  i2c_writeByte(&bus, 0xFF);//data....
  i2c_writeByte(&bus, 0x00);
  i2c_writeByte(&bus, 0xFF);
  i2c_writeByte(&bus, 0x00);
  i2c_writeByte(&bus, 0xFF);
  i2c_stop(&bus);

pause(10000);

Comments

  • Kraken767Kraken767 Posts: 5
    edited 2014-10-24 20:38
    ive been looking over and over the datasheet, just when i think i got it, it dont work http://www.displayfuture.com/Display/datasheet/controller/SH1106.pdf
    it'd be great if anyone could help me find out what im doing wrong.

    my latest test code:
    i2c bus;  
      i2c_open(&bus, 9, 8, 0);
      i2c_start(&bus);
      i2c_writeByte(&bus, 0x78);//device adress, write
    
      //i2c_writeByte(&bus, 0x80);//cont com
      //i2c_writeByte(&bus, 0x40);//set disp line start
    
      //i2c_writeByte(&bus, 0x80);//cont com
      //i2c_writeByte(&bus, 0xA4);//set disp on
    
      i2c_writeByte(&bus, 0x80);//cont com
      i2c_writeByte(&bus, 0xB0);//set disp page 0
    
      i2c_writeByte(&bus, 0x80);//cont com
      i2c_writeByte(&bus, 0x10);//set disp column high 0
    
      i2c_writeByte(&bus, 0x80);//cont com
      i2c_writeByte(&bus, 0x0);//set disp column low 0 
    
      i2c_writeByte(&bus, 0x80);//cont com
      i2c_writeByte(&bus, 0xE0);// read write modify start
    
      i2c_writeByte(&bus, 0xC0);//cont, ram
      i2c_writeByte(&bus, 0xF0);//data....
      
      i2c_writeByte(&bus, 0x0);//last, com
      i2c_writeByte(&bus, 0xEE);// read write modify end
    i2c_stop(&bus);
    
  • Hal AlbachHal Albach Posts: 747
    edited 2014-10-25 07:40
    Try using a 7 bit address. I believe the I2C write function adds bit 0 to the address and will change your 0x78 to 0xF0
     i2c_writeByte(&bus, 0b0111100);         //device adress, write
    
  • Kraken767Kraken767 Posts: 5
    edited 2014-10-25 08:22
    i ran an i2c scanner with i2c_poll, it gave me back 0x78. also, on the back of my display and in the datasheet it gives me 0x78 as the address
  • Hal AlbachHal Albach Posts: 747
    edited 2014-10-25 10:55
    Does the SH1106 ACK the writes?
  • Kraken767Kraken767 Posts: 5
    edited 2014-10-25 11:39
    Im not sure about the writes, Ive just been using the simplei2c library. As far as I know, i2c_poll looks for an ACK from a device, and im getting one from that.
Sign In or Register to comment.