51单片机 IIC OLED屏幕驱动+Proteus仿真+实物验证示例程序
- Proteus仿真效果
示例主程序
#include "REG51.h"
#include "oled.h"
#include "bmp.h"
int main(void)
{ u8 t;
OLED_Init(); //初始化OLED
OLED_Clear();
t=' ';
while(1)
{
OLED_Clear();
OLED_ShowCHinese(0,0,0);//中
OLED_ShowCHinese(18,0,1);//景
OLED_ShowCHinese(36,0,2);//园
OLED_ShowCHinese(54,0,3);//电
OLED_ShowCHinese(72,0,4);//子
OLED_ShowCHinese(90,0,5);//科
OLED_ShowCHinese(108,0,6);//技
OLED_ShowString(6,3,"0.96' OLED TEST",16);
//OLED_ShowString(8,2,"ZHONGJINGYUAN");
// OLED_ShowString(20,4,"2014/05/01");
OLED_ShowString(0,6,"ASCII:",16);
OLED_ShowString(63,6,"CODE:",16);
OLED_ShowChar(48,6,t,16);//显示ASCII字符
t++;
if(t>'~')t=' ';
OLED_ShowNum(103,6,t,3,16);//显示ASCII字符的码值
delay_ms(2000);
OLED_DrawBMP(0,0,128,8,BMP1); //图片显示(图片显示慎用,生成的字表较大,会占用较多空间,FLASH空间8K以下慎用)
delay_ms(5000);
OLED_DrawBMP(0,0,128,8,BMP1);
delay_ms(5000);
}
}
程序源码
- 0.96寸(4管脚)资料OLED资料包
https://pan.baidu.com/s/1J57Izsv-PKmbwVrA2ynDzg
提取码:vktz
版权声明:本文为CSDN博主「perseverance52」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/weixin_42880082/article/details/121746237
暂无评论