want to change the contrast of OLEDM204 with I2C interface using PIC16F1823

Submitted by qhb on Sat, 05/18/2019 - 17:59

hi

i have done interfacing of OLEDM204 with PIc16f1823 and now i want to change contrast, but i fail.

below  the code setup for initialisation please review and guide me where i am wrong ,

as they said in datasheet you have to set RE and SD pin but still not get the result.

 

I2C_Is_Idle();
     I2C1_Start();
     I2C_Is_Idle();
     I2C1_Wr(0x78);
     I2C_Is_Idle();
     I2C1_Wr(0x80);
    I2C_Is_Idle();
    I2C1_Wr(0x08); //Display blink cursor OFF
    I2C_Is_Idle();
    I2C1_Wr(0x3A); //FunctionSet: N=1 BE=0 RE=1 IS=0
    I2C_Is_Idle();
    
    I2C1_Wr(0x79);    //set SD
     I2C_Is_Idle();
     
     I2C1_Wr(0xFF);   //set contrast
     I2C_Is_Idle();
     
    I2C1_Wr(0x09); //4-line mode
    I2C_Is_Idle();
    I2C1_Wr(0x05); //View 0°
    I2C_Is_Idle();
    I2C1_Wr(0x38); //FunctionSet: N=1 DH=0 RE=0 IS=0
    I2C_Is_Idle();
    I2C1_Wr(0x3A); //FunctionSet: N=1 BE=0 RE=1 IS=0
    I2C_Is_Idle();
    I2C1_Wr(0x72); //ROM Selection (RE muss 1 sein)
    I2C_Is_Idle();
    I2C1_Wr(0x00); //ROM_A = 0x00, ROM_B = 0x04, ROM_C = 0x0C
    I2C_Is_Idle();
    I2C1_Wr(0x38); //FunctionSet: N=1 DH=0 RE=0 IS=0
    I2C_Is_Idle();
    I2C1_Wr(0x0D); //Display blink cursor on
    I2C_Is_Idle();
    I2C1_Wr(0x01); //Clear display
    I2C_Is_Idle();
    I2C1_Stop();