OLEDSSD1306与SSD1315在初始化的区别

合集下载
  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

OLEDSSD1306与SSD1315在初始化的区别
在使⽤0.96⼨的OLED时,发现之前的代码不能正常通过单⽚机的IIC使⽤DMA进⾏刷新,刷新时总是错⼀位,后来查阅资料发现是现在的OLED使⽤了SSD1315替换了SSD1306控制芯⽚,贴⼀下各个初始化过程,⽅便记录:
SSD1306初始化:
1/**
2 * @brief OLED初始化
3 * @param None
4 * @retval None.
5*/
6void OLED_Init(void)
7 {
8#if SENDDTA_DMA
9 I2C_DMA_WriteReg( (uint8_t*)OLED_Init_CMD, OLED_ADDRESS,OLED_WriteCom_Addr,sizeof(OLED_Init_CMD)); //sizeof(OLED_Init_CMD)
10#else
11// DelayMs(100); //这⾥的延时很重要
12 delay_ms(10);
13 WriteCmd(0xAE); //display off
14 WriteCmd(0x20); //Set Memory Addressing Mode
15 WriteCmd(0x10); //00,Horizontal Addressing Mode;01,Vertical Addressing Mode;10,Page Addressing Mode (RESET);11,Invalid
16 WriteCmd(0xb0); //Set Page Start Address for Page Addressing Mode,0-7
17 WriteCmd(0xc8); //Set COM Output Scan Direction
18 WriteCmd(0x00); //---set low column address
19 WriteCmd(0x10); //---set high column address
20 WriteCmd(0x40); //--set start line address
21 WriteCmd(0x81); //--set contrast control register
22 WriteCmd(0xff); //亮度调节 0x00~0xff
23 WriteCmd(0xa1); //--set segment re-map 0 to 127
24 WriteCmd(0xa6); //--set normal display
25 WriteCmd(0xa8); //--set multiplex ratio(1 to 64)
26 WriteCmd(0x3F); //
27 WriteCmd(0xa4); //0xa4,Output follows RAM content;0xa5,Output ignores RAM content
28 WriteCmd(0xd3); //-set display offset
29 WriteCmd(0x00); //-not offset
30 WriteCmd(0xd5); //--set display clock divide ratio/oscillator frequency
31 WriteCmd(0xf0); //--set divide ratio
32 WriteCmd(0xd9); //--set pre-charge period
33 WriteCmd(0x22); //
34 WriteCmd(0xda); //--set com pins hardware configuration
35 WriteCmd(0x12);
36 WriteCmd(0xdb); //--set vcomh
37 WriteCmd(0x20); //0x20,0.77xVcc
38 WriteCmd(0x8d); //--set DC-DC enable
39 WriteCmd(0x14); //
40 WriteCmd(0xaf); //--turn on oled panel
41#endif
42 }
这⾥使⽤默认是刷新⽅式,按照页写数据没有问题,使⽤DMA时需要把照寻址⽅式修改为了⽔平寻址时就出现了刷新数据不对的问题
为此,我直接使⽤了⽹络上默认的⽅式对DMA发送指令进⾏初始化
const uint8_t OLED_Init_CMD[] =
{
0xAE,0x00,0x10,0x40,0xB0,0x81,0xFF,0xA1,0xA6,0xA8,
0x3F,0xC8,0xD3,0x00,0xD5,0x80,0xD8,0x05,0xD9,0xF1,
0xDA,0x12,0xDB,0x30,0x8D,0x14,0xAF,0x20,0x00
};
发现使⽤改⽅式刷新SSD1315类型的OLED时会出问题,对其进⾏修改:
const uint8_t OLED_Init_CMD[] =
{
0xae,0x00,0x10,0x40,0x81,0xcf,0xa1,0xc8,0xa6,0xa8,
0x3f,0xd3,0x00,0xd5,0x80,0xd9,0xf1,0xda,0x12,0xdb,
0x40,0x20,0x00,0x8d,0x14,0xa4,0xa6,0xaf
};
⽴刻正常,看来两个⽚⼦的⼯作模式还是有些区别的。

相关文档
最新文档