STC8A8K64S4A12单片机 0.96OLED显示屏_SPI_例程KEIL工程文件源码:
int main(void)
{ //u16 t;
//delay_init(); //延时函数初始化
// NVIC_Configuration(); //设置NVIC中断分组2:2位抢占优先级,2位响应优先级 LED_Init(); //LED端口初始化
OLED_Init(); //初始化OLED
OLED_Clear() ;
/*
OLED_ShowString(30,0,"OLED TEST");
OLED_ShowString(8,2,"ZHONGJINGYUAN");
OLED_ShowString(20,4,"2014/05/01");
OLED_ShowString(0,6,"ASCII:");
OLED_ShowString(63,6,"CODE:");
t=' ';
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);//技
*/
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_ShowString(0,2,"1.3' OLED TEST");
// OLED_ShowString(8,2,"ZHONGJINGYUAN");
OLED_ShowString(20,4,"2017/06/15");
OLED_ShowString(0,6,"ASCII:");
OLED_ShowString(63,6,"CODE:");
while(1);
// OLED_ShowChar(48,6,t);//显示ASCII字符
// t++;
// if(t>'~')t=' ';
// OLED_ShowNum(103,6,t,3,16);//显示ASCII字符的码值
// delay_ms(500);
// OLED_Clear();
// delay_ms(500);
// OLED_DrawBMP(0,0,128,8,BMP1); //图片显示(图片显示慎用,生成的字表较大,会占用较多空间,FLASH空间8K以下慎用)
// delay_ms(500);
// OLED_DrawBMP(0,0,128,8,BMP2);
// delay_ms(500);
}
}