1.3寸OLED(SH1106)并不从地址0开始显示。。。。。

2019-07-21 08:37发布

本帖最后由 Di诺 于 2018-10-27 17:09 编辑

        gm_write_oled_command(0xAE);

        gm_write_oled_command(0x00);
        gm_write_oled_command(0x10);


         gm_write_oled_command(0x40);//设置起始地址为0
        gm_write_oled_command(0x81);   

        gm_write_oled_command(0xcf);
        gm_write_oled_command(0xa1);

        gm_write_oled_command(0xc8);   

        gm_write_oled_command(0xa6);
        gm_write_oled_command(0xa8);   

        gm_write_oled_command(0x3f);   

        gm_write_oled_command(0xd3);   

        gm_write_oled_command(0x00);

        gm_write_oled_command(0xd5);   

        gm_write_oled_command(0x80);
        gm_write_oled_command(0xd9);   

        gm_write_oled_command(0xf1);
        gm_write_oled_command(0xda);   

        gm_write_oled_command(0x12);
        gm_write_oled_command(0xdb);   

        gm_write_oled_command(0x40);   

        gm_write_oled_command(0x20);   


        gm_write_oled_command(0x02);

        gm_write_oled_command(0x8d);   
        gm_write_oled_command(0x14);   
        gm_write_oled_command(0xa4);   
        gm_write_oled_command(0xa6);   
        gm_write_oled_command(0xaf);   


void gm_set_oled_write_addr(uint8_t x, uint8_t y)//设置显示地址
{
    gm_write_oled_command(0xb0 + y);  

    gm_write_oled_command(((x & 0xf0) >> 4) | 0x10);
    gm_write_oled_command(x & 0x0f);
}

const uint8_t m_pic_matix[] =
{
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,

};

void gm_display_pic(void)//测试函数
{
    uint8_t *p, i, j;

    p = (uint8_t *)m_pic_matix;

    for(j = 0; j < 2; j++)
    {
        gm_set_oled_write_addr(0, j);

        for(i = 0; i < 8; i++)
        {
            gm_write_oled_data(*p);
            p++;         
        }        
    }
}

显示发现,图像的前两列并未显示,即八列的0xff只显示六列

友情提示: 此问题已得到解决,问题已经关闭,关闭后问题禁止继续编辑,回答。