IIC interface completes OLED screen display



1. Download related materials

Download driver:
0.96inch OLED Module MC096VX
Insert picture description here
Insert picture description here
download font software
Link: https://pan.baidu.com/s/13bnrB-S8Y6JDRdXBbzzbjA
Extraction code: pmf1
Insert picture description here

2. Name and student number display

Decompress the downloaded driver,
Insert picture description here
open the project file,
Insert picture description here
Insert picture description here
open the font software, and
change the setting to:
Insert picture description here
modify main.c and change it to

#include "delay.h"
#include "sys.h"
#include "oled.h"
#include "bmp.h"
 int main(void)
  {
    
    	u8 t;
		delay_init();	    	 //延时函数初始化	  
		NVIC_Configuration(); 	 //设置NVIC中断分组2:2位抢占优先级,2位响应优先级 	LED_Init();			     //LED端口初始化
	//		delay_ms(8000);
		OLED_Init();			//初始化OLED  
		OLED_Clear(0)  	; 	
		t=' ';
		
	while(1) 
	{
    
    		

		OLED_ShowCHinese(6,0,0);
		OLED_ShowCHinese(26,0,1);
		OLED_ShowCHinese(46,0,2);
		OLED_ShowString(4,3,"631807030235",16);   
		t++;
		delay_ms(500);
	}	  	
}

To modify oledfont.h, you only need to modify the first three, don’t care about the latter, paste your own font code to
Insert picture description here
generate a hex file after compilation, and then burn it (in the experiment, it was done but I forgot to take a picture, so There is no final picture)
Insert picture description here

Three, sliding display

Generate fonts
Insert picture description here
modify oledfont.h
Insert picture description here
modify main.c

#include "delay.h"
#include "sys.h"
#include "oled.h"
#include "bmp.h"

 int main(void)
{
    
    	
		delay_init();	    	 //延时函数初始化	  
		NVIC_Configuration(); 	 //设置NVIC中断分组2:2位抢占优先级,2位响应优先级 	LED_Init();			     //LED端口初始化
	//		delay_ms(8000);
		OLED_Init();			//初始化OLED  
		OLED_Clear(0)  	; 
	
		
	  OLED_ShowString(4,3,"hello",16);
	  OLED_ShowCHinese(6,0,0);
	  OLED_ShowCHinese(26,0,1);

	  delay_ms(50000);
	  
	  OLED_WR_Byte(0x2e,OLED_CMD);;//关滚动
	  OLED_WR_Byte(0x2A,OLED_CMD);//29向右,2a向左
	  OLED_WR_Byte(0x00,OLED_CMD);//A:空字节
	  OLED_WR_Byte(0x00,OLED_CMD);//B:水平起始页
	  OLED_WR_Byte(0x00,OLED_CMD);//C:水平滚动速度
	  OLED_WR_Byte(0x07,OLED_CMD);//D:水平结束页
	  OLED_WR_Byte(0x01,OLED_CMD);//E:每次垂直滚动位移
	  OLED_WR_Byte(0x2f,OLED_CMD);//开滚动  
		
}

Generate a hex file and burn it (again, forget to take pictures.)
Insert picture description here

Guess you like

Origin blog.csdn.net/aiwr_/article/details/111798487