请问有谁用过SSD1327Z这款驱动IC的OLED吗?
我这边使用厂商的初始化源码没有点亮。有什么要注意的吗?
使用STM32103C8的模拟SPI驱动
_Write_CommandCmd(0xAE);
_Write_CommandCmd(0x15); // Set column address
_Write_CommandCmd(0x00); // Start column 0
_Write_CommandCmd(0x3f); // End column 127
_Write_CommandCmd(0x75); // Set row address
_Write_CommandCmd(0x00); // Start row 0
_Write_CommandCmd(0x7f); // End row 127
_Write_CommandCmd(0x81); // Set contrast control
_Write_CommandCmd(0x80);
_Write_CommandCmd(0xa0); // Segment remap
_Write_CommandCmd(0x51);
_Write_CommandCmd(0xa1); // Start line
_Write_CommandCmd(0x00);
_Write_CommandCmd(0xa2); // Display offset
_Write_CommandCmd(0x00);
_Write_CommandCmd(0xa4); // Normal display
_Write_CommandCmd(0xa8); // Set multiplex ratio
_Write_CommandCmd(0x7f);
_Write_CommandCmd(0xb1); // Set phase length
_Write_CommandCmd(0xf1);
_Write_CommandCmd(0xb3); // Set dclk
_Write_CommandCmd(0x00); // 80Hz:0xc1 90Hz:0xe1 100Hz:0x00 110Hz:0x30
// 120Hz:0x50 130Hz:0x70
_Write_CommandCmd(0xab);
_Write_CommandCmd(0x01);
_Write_CommandCmd(0xb6); // Set phase length
_Write_CommandCmd(0x0f);
_Write_CommandCmd(0xbe);
_Write_CommandCmd(0x0f);
_Write_CommandCmd(0xbc);
_Write_CommandCmd(0x08);
_Write_CommandCmd(0xd5);
_Write_CommandCmd(0x62);
_Write_CommandCmd(0xfd);
_Write_CommandCmd(0x12);
_Write_CommandCmd(0xae);
友情提示: 此问题已得到解决,问题已经关闭,关闭后问题禁止继续编辑,回答。
这块IC取消了0xB0这部分的寄存器。所以在刷屏的时候,不需要对寄存器操作,直接将数据刷新到SPI上就行了。
还有就是这IC的一个像素点是4位的。所以会出现亮度的深浅。而且要注意点阵的刷新方式。
SPI模拟方式
unsigned char i;
//判断命令还是数据
(DataType == OLED_COMMAND_TYPE)?(OLED_COMMAND_ENABLE)OLED_DATA_ENABLE);
//片选使能
OLED_SELECT;
//数据传输
for(i=0;i<8;i++)
{
OLED_SCLK_RESET;
if(Data&0x80)
{
OLED_SDIN_SET;
}
else
{
OLED_SDIN_RESET;
}
OLED_SCLK_SET;
Data<<=1;
}
//取消片选
OLED_NOT_SELECT;
OLED_DATA_ENABLE;
这是刷新屏幕代码
unsigned char OLED_RAM[128][16]; //当时没有注意到这个像素点是4位的所以用了这个数组。所以分了将char型分了4个部分进行传输。
其实可以使用OLED_RAM[128][64];这样就不需要进行位移等操作。而且可以实现一些灰度的显示。
for(j=0;j<128;j++)
{
for(i=0;i<16;i++)
{
for(k = 0;k<4;k++)
{
if(k == 0)
{
Transfer_Char = (OLED_RAM[j]&0xC0)>>3;
}
else if(k == 1)
{
Transfer_Char = (OLED_RAM[j]&0x30)>>1;
}
else if(k == 2)
{
Transfer_Char = (OLED_RAM[j]&0x0C)<<1;
}
else if(k == 3)
{
Transfer_Char = (OLED_RAM[j]&0x03)<<3;
}
if((Transfer_Char&0xF0) != 0x00)
{
Transfer_Char |= 0xF0;
}
if((Transfer_Char&0x0F) != 0x00)
{
Transfer_Char |= 0x0F;
}
_Write_DataCmd(Transfer_Char);
}
}
}
{
for(i=0;i<16;i++)
{
for(k = 0;k<4;k++)
{
if(k == 0)
{
Transfer_Char = (OLED_RAM[j]&0xC0)>>3;
}
else if(k == 1)
{
Transfer_Char = (OLED_RAM[j]&0x30)>>1;
}
else if(k == 2)
{
Transfer_Char = (OLED_RAM[j]&0x0C)<<1;
}
else if(k == 3)
{
Transfer_Char = (OLED_RAM[j]&0x03)<<3;
}
if((Transfer_Char&0xF0) != 0x00)
{
Transfer_Char |= 0xF0;
}
if((Transfer_Char&0x0F) != 0x00)
{
Transfer_Char |= 0x0F;
}
_Write_DataCmd(Transfer_Char);
}
}
}
一周热门 更多>