OLED显示屏 SH1106的初始化数据
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
/***********************OLED128*64_SH1106初始化*****************************/
void Initial_OLED12864_SH1106() //OLED初始化
{
delay_50ms(2); //延时100ms
Write_IIC_Command(0xAE); //Display OFF/ON
//显示关/开(OLED关闭显示:AEH,OLED开启显示:AFH)
Write_IIC_Command(0x02); //Set Column Address 4 lower bits 设置列地址低4位(00H--0FH)(0 0 0 0 A3 A2 A1 A0)
Write_IIC_Command(0x10); //Set Column Address 4 higher bits 设置列地址高4位(10H--17H)(0 0 0 1 A7 A6 A5 A4)
Write_IIC_Command(0xB0); //Set Page Address
//设置页面地址(1页:B0H,2页:B1H,3页:B2H,4页:B3H,5页:B4H,6页:B5H,7页:B6H)
Write_IIC_Command(0x40); //Set Display Start Line 设置显示开始行
Write_IIC_Command(0xA1); //Set Segment Re-map (ADC) 设置段重新映射(ADC)(正向:A0H, 反向A1H)
Write_IIC_Command(0xA7); //Set Normal/ Reverse Display
//设置正常/反白显示(正常显示:A6H,反白显示:A7H)
Write_IIC_Command(0xA8); //Multiplex Ration Mode Set //多路分配模式设置
Write_IIC_Command(0x3F); //Multiplex Ratio Data Set
//多路复用率数据设置(1:00H, 2:02H,3:03H,······63:3EH,64:3FH)
Write_IIC_Command(0xA4); //Set Entire Display OFF/ON
//设置全屏显示关/开(正常显示:A4H,全屏显示:A5H)
Write_IIC_Command(0xD3); //Display Offset Mode Set 显示偏移模式设置
Write_IIC_Command(0x00); //Display Offset Data Set
//显示偏移数据设置(COM0:00H, COM1:02H, COM2:03H, ······COM62:3EH, COM63:3FH)
Write_IIC_Command(0xD5); //Divide Ratio/Oscillator Frequency Mode Set 分频比/振荡器频率模式设置
Write_IIC_Command(0x50); // Divide Ratio/Oscillator Frequency Data Set
//分频比/振荡器频率数据设置(80H:+15%, 50H:0%)
//(详细介绍参见:中景园1.3寸OLED显示屏_驱动芯片手册.pdf Command15 驱动芯片:SH1106)
Write_IIC_Command(0xAD); //DC-DC Control Mode Set 直流-直流转换器电源控制方式设置(打开)
Write_IIC_Command(0x8B); //DC-DC ON/OFF Mode Set
//直流-直流转换器电源开/关模式设置(直流-直流转换器电源禁用:8AH,显示时直流-直流转换器电源将会打开:8BH)
Write_IIC_Command(0xC8); //Set Common Output Scan Direction
//设置公用输出扫描方向(从COM0向COM[N-1]扫描:C0H,从COM[N-1]向COM0扫描:C8H)
Write_IIC_Command(0xD9); //Pre-charge Period Mode Set 预充电周期模式设置
Write_IIC_Command(0x22); //Dis-charge /Pre-charge Period Data Set
//无充电/预充电周期数据设置
//(详细介绍参见:中景园1.3寸OLED显示屏_驱动芯片手册.pdf Command16 驱动芯片:SH1106)
Write_IIC_Command(0xDA); //Common Pads Hardware Configuration Mode Set 常见的引脚硬件配置模式设置
Write_IIC_Command(0x12); //Sequential/Alternative Mode Set
//顺序/替代模式设置(顺序:02H,替代:12H)
//(详细介绍参见:中景园1.3寸OLED显示屏_驱动芯片手册.pdf Command17 驱动芯片:SH1106)
Write_IIC_Command(0x81); //The Contrast Control Mode Set 对比度控制模式设置
Write_IIC_Command(0x79); //Contrast Data Register Set
//对比数据寄存器设置(ISEG Small:00H, Large:FFH, 不使用此功能:80H)
Write_IIC_Command(0xDB); //VCOM Deselect Level Mode Set VCOM取消级别模式设置
Write_IIC_Command(0x35); //VCOM Deselect Level Data Set
//VCOM取消级数据设置(VCOM=0.430*VREF:00H,VCOM=0.770*VREF:35H,VCOM=1*VREF:40H)
//(详细介绍参见:中景园1.3寸OLED显示屏_驱动芯片手册.pdf Command18 驱动芯片:SH1106)
Write_IIC_Command(0x32); //Set Pump voltage value
//设置泵电压值Vpp(30H:6.4V, 31H:7.4V, 32H:8.0V
33H:9.0V)
delay_1ms(1); //延时1ms
Write_IIC_Command(0xAF); //Display OFF/ON
//显示关/开(OLED关闭显示:AEH,OLED开启显示:AFH)
delay_50ms(2); //延时100ms
}。