|
本帖最后由 xda 于 2020-2-27 11:07 編輯
說起來奇怪,在開始使用中景園的歷程點(diǎn)亮oled的時(shí)候,發(fā)現(xiàn)iic的初始化時(shí)序部分居然可以用spi的,查看ssd1306的手冊(cè)許久,也沒看出來所以然
只變了時(shí)序部分,我會(huì)在下面貼出來,其他什么都沒變,為什么顯示會(huì)有這么大差別呢,到底是我哪里沒注意到,,望大神指點(diǎn)
===================================iic原本時(shí)序===========================================
delay_ms(200);
OLED_WR_Byte(0xAE,OLED_CMD);//關(guān)閉顯示
OLED_WR_Byte(0xf0,OLED_CMD);//---set low column address
OLED_WR_Byte(0x0f,OLED_CMD);//---set high column address
OLED_WR_Byte(0xC8,OLED_CMD);//-not offset
OLED_WR_Byte(0x81,OLED_CMD);//設(shè)置對(duì)比度
OLED_WR_Byte(0xff,OLED_CMD);
OLED_WR_Byte(0xa1,OLED_CMD);//段重定向設(shè)置
OLED_WR_Byte(0xa6,OLED_CMD);//
OLED_WR_Byte(0xa8,OLED_CMD);//設(shè)置驅(qū)動(dòng)路數(shù)
OLED_WR_Byte(0x1f,OLED_CMD);
OLED_WR_Byte(0xd3,OLED_CMD);
OLED_WR_Byte(0x00,OLED_CMD);
OLED_WR_Byte(0xd5,OLED_CMD);
OLED_WR_Byte(0xf0,OLED_CMD);
OLED_WR_Byte(0xd9,OLED_CMD);
OLED_WR_Byte(0x22,OLED_CMD);
OLED_WR_Byte(0xda,OLED_CMD);
OLED_WR_Byte(0x02,OLED_CMD);
OLED_WR_Byte(0xdb,OLED_CMD);
OLED_WR_Byte(0x49,OLED_CMD);
OLED_WR_Byte(0x8d,OLED_CMD);
OLED_WR_Byte(0x14,OLED_CMD);
OLED_WR_Byte(0xaf,OLED_CMD);
OLED_Clear();
===================================iic原本時(shí)序===========================================
===================================移植spi時(shí)序===========================================
OLED_WR_Byte(0xAE,OLED_CMD);//--turn off oled panel
// OLED_WR_Byte(0xf0,OLED_CMD);//---set low column address
// OLED_WR_Byte(0x0f,OLED_CMD);//---set high column address
// OLED_WR_Byte(0x40,OLED_CMD);//--set start line address Set Mapping RAM Display Start Line (0x00~0x3F)
// OLED_WR_Byte(0x81,OLED_CMD);//--set contrast control register
// OLED_WR_Byte(0xCF,OLED_CMD); // Set SEG Output Current Brightness
// OLED_WR_Byte(0xA1,OLED_CMD);//--Set SEG/Column Mapping 0xa0左右反置 0xa1正常
// OLED_WR_Byte(0xC8,OLED_CMD);//Set COM/Row Scan Direction 0xc0上下反置 0xc8正常
// OLED_WR_Byte(0xA6,OLED_CMD);//--set normal display
// OLED_WR_Byte(0xA8,OLED_CMD);//--set multiplex ratio(1 to 64)
// OLED_WR_Byte(0x3f,OLED_CMD);//--1/64 duty
// OLED_WR_Byte(0xD3,OLED_CMD);//-set display offset Shift Mapping RAM Counter (0x00~0x3F)
// OLED_WR_Byte(0x00,OLED_CMD);//-not offset
// OLED_WR_Byte(0xd5,OLED_CMD);//--set display clock divide ratio/oscillator frequency
// OLED_WR_Byte(0x80,OLED_CMD);//--set divide ratio, Set Clock as 100 Frames/Sec
// OLED_WR_Byte(0xD9,OLED_CMD);//--set pre-charge period
// OLED_WR_Byte(0xF1,OLED_CMD);//Set Pre-Charge as 15 Clocks & Discharge as 1 Clock
// OLED_WR_Byte(0xDA,OLED_CMD);//--set com pins hardware configuration
// OLED_WR_Byte(0x12,OLED_CMD);
// OLED_WR_Byte(0xDB,OLED_CMD);//--set vcomh
// OLED_WR_Byte(0x40,OLED_CMD);//Set VCOM Deselect Level
// OLED_WR_Byte(0x20,OLED_CMD);//-Set Page Addressing Mode (0x00/0x01/0x02)
// OLED_WR_Byte(0x02,OLED_CMD);//
// OLED_WR_Byte(0x8D,OLED_CMD);//--set Charge Pump enable/disable
// OLED_WR_Byte(0x14,OLED_CMD);//--set(0x10) disable
// OLED_WR_Byte(0xA4,OLED_CMD);// Disable Entire Display On (0xa4/0xa5)
// OLED_WR_Byte(0xA6,OLED_CMD);// Disable Inverse Display On (0xa6/a7)
// OLED_WR_Byte(0xAF,OLED_CMD);//--turn on oled panel
//
// OLED_WR_Byte(0xAF,OLED_CMD); /*display ON*/
// OLED_Clear();
// OLED_Set_Pos(0,0);
===================================移植spi時(shí)序(去掉屏蔽符號(hào))======================================
這兩個(gè)到底哪里不同會(huì)導(dǎo)致字體大小差異呢,其他函數(shù)都沒變,一點(diǎn)都沒改過,偶爾在點(diǎn)屏的時(shí)候發(fā)現(xiàn)的一點(diǎn)小意外
|
|