1. 了解字符 OLED 模块的使用方法; 2. 掌握 STM32 控制字符 OLED 模块显示程序的设计方法; 3. 掌握 OLED 取字模的方法。
利用 OLED 屏显示汉字和字符。
#include "stm32f10x.h" #include "systick.h" #include "oled.h" /* * 函数名:main * 描述 : 主函数 * 输入 :无 * 输出 : 无 */ int main(void) { /* 设置系统时钟为72M */ SystemInit(); OLED_Init(); //初始化OLED LCD_P16x16Ch(32,7,0); //测 LCD_P16x16Ch(48,7,1); //试 LCD_P16x16Ch(64,7,2); //例 LCD_P16x16Ch(80,7,3); //程 LCD_P8x16Ch(16,5,9); //D LCD_P8x16Ch(24,5,10); //V LCD_P8x16Ch(32,5,11); //C LCD_P8x16Ch(40,5,11); //C LCD_P16x16Ch(48,5,4); //系 LCD_P16x16Ch(64,5,5); //列 LCD_P16x16Ch(80,5,6); //产 LCD_P16x16Ch(96,5,7); //品 LCD_P8x16Ch(16,3,0); //S LCD_P8x16Ch(24,3,1); //T LCD_P8x16Ch(32,3,2); //M LCD_P8x16Ch(40,3,3); //3 LCD_P8x16Ch(48,3,4); //2 LCD_P8x16Ch(56,3,5); //F LCD_P8x16Ch(64,3,6); //1 LCD_P8x16Ch(72,3,7); //0 LCD_P8x16Ch(80,3,8); //3 LCD_P8x16Ch(0,1,13); //L LCD_P8x16Ch(8,1,14); //E LCD_P8x16Ch(16,1,15); //A LCD_P8x16Ch(24,1,16); //R LCD_P8x16Ch(32,1,17); //N LCD_P8x16Ch(40,1,18); // LCD_P8x16Ch(48,1,19); //S LCD_P8x16Ch(56,1,20); //T LCD_P8x16Ch(64,1,21); //A LCD_P8x16Ch(72,1,22); //R LCD_P8x16Ch(80,1,23); //T LCD_P8x16Ch(88,1,24); //! LCD_P8x16Ch(96,1,24); //! LCD_P8x16Ch(104,1,24); //! while (1) { ; } }
在 oled.c 中有如下两处内容相关的地方:
u8 const F16x16[] = { 0x08,0x06,0x40,0x31,0x00,0x7F,0x40,0x4F,0x40,0x7F,0x00,0x1F,0x00,0xFF,0x00,0x00, 0x20,0x20,0x7E,0x80,0x01,0xE2,0x0C,0xF0,0x08,0xE4,0x00,0xE2,0x01,0xFE,0x00,0x00,/*"测",0*/ 0x02,0x02,0x42,0x33,0x00,0x09,0x09,0x09,0x09,0x09,0xFF,0x08,0x88,0x68,0x08,0x00, 0x00,0x00,0x00,0xFC,0x08,0x14,0x06,0xFC,0x08,0x08,0x80,0x70,0x0C,0x02,0x0F,0x00,/*"试",1*/ 0x01,0x06,0x1F,0xE0,0x00,0x21,0x3E,0x24,0x24,0x27,0x00,0x1F,0x00,0xFF,0x00,0x00, 0x00,0x00,0xFF,0x00,0x21,0xC2,0x84,0x48,0x30,0xC0,0x00,0xF2,0x01,0xFE,0x00,0x00,/*"例",2*/ 0x24,0x24,0x25,0x7F,0xC4,0x44,0x00,0x7C,0x44,0x44,0x44,0x44,0x44,0x7C,0x00,0x00, 0x10,0x60,0x80,0xFF,0x80,0x60,0x02,0x92,0x92,0x92,0xFE,0x92,0x92,0x92,0x82,0x00,/*"程",3*/ 0x00,0x00,0x44,0x4C,0x54,0x65,0x45,0x46,0x84,0x88,0x90,0x81,0x80,0x00,0x00,0x00, 0x00,0x42,0x44,0xC8,0xD0,0x42,0x41,0x7E,0x40,0x40,0x50,0x48,0xC4,0x62,0x00,0x00,/*"系",4*/ 0x00,0x40,0x43,0x4C,0x78,0x48,0x48,0x4F,0x40,0x00,0x1F,0x00,0x00,0xFF,0x00,0x00, 0x40,0x81,0x02,0x84,0x48,0x30,0xC0,0x00,0x00,0x00,0xF0,0x02,0x01,0xFE,0x00,0x00,/*"列",5*/ 0x00,0x20,0x21,0x21,0x29,0x27,0xA1,0x61,0x21,0x23,0x2D,0x21,0x21,0x21,0x01,0x00, 0x01,0x06,0xF8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,/*"产",6*/ 0x00,0x00,0x00,0x7E,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x7E,0x00,0x00,0x00,0x00, 0x00,0x7F,0x42,0x42,0x42,0x7F,0x00,0x00,0x00,0x7F,0x42,0x42,0x42,0x7F,0x00,0x00};/*"品",7*/ u8 const F8x16[] = { 0x00,0x0E,0x11,0x10,0x10,0x10,0x1C,0x00,0x00,0x1C,0x04,0x84,0x84,0x44,0x38,0x00,/*"S",0*/ 0x18,0x10,0x10,0x1F,0x10,0x10,0x18,0x00,0x00,0x00,0x04,0xFC,0x04,0x00,0x00,0x00,/*"T",1*/ 0x10,0x1F,0x1F,0x00,0x1F,0x1F,0x10,0x00,0x04,0xFC,0x00,0xFC,0x00,0xFC,0x04,0x00,/*"M",2*/ 0x00,0x0C,0x10,0x11,0x11,0x12,0x0C,0x00,0x00,0x18,0x04,0x04,0x04,0x88,0x70,0x00,/*"3",3*/ 0x00,0x0E,0x10,0x10,0x10,0x11,0x0E,0x00,0x00,0x0C,0x14,0x24,0x44,0x84,0x0C,0x00,/*"2",4*/ 0x10,0x1F,0x11,0x11,0x17,0x10,0x08,0x00,0x04,0xFC,0x04,0x00,0xC0,0x00,0x00,0x00,/*"F",5*/ 0x00,0x08,0x08,0x1F,0x00,0x00,0x00,0x00,0x00,0x04,0x04,0xFC,0x04,0x04,0x00,0x00,/*"1",6*/ 0x00,0x07,0x08,0x10,0x10,0x08,0x07,0x00,0x00,0xF0,0x08,0x04,0x04,0x08,0xF0,0x00,/*"0",7*/ 0x00,0x0C,0x10,0x11,0x11,0x12,0x0C,0x00,0x00,0x18,0x04,0x04,0x04,0x88,0x70,0x00,/*"3",8*/ 0x10,0x1F,0x10,0x10,0x10,0x08,0x07,0x00,0x04,0xFC,0x04,0x04,0x04,0x08,0xF0,0x00,/*"D",9*/ 0x10,0x1E,0x11,0x00,0x00,0x13,0x1C,0x10,0x00,0x00,0xE0,0x1C,0x70,0x80,0x00,0x00,/*"V",10*/ 0x03,0x0C,0x10,0x10,0x10,0x10,0x1C,0x00,0xE0,0x18,0x04,0x04,0x04,0x08,0x10,0x00,/*"C",11*/ 0x00,0x07,0x08,0x11,0x11,0x18,0x00,0x00,0x00,0xF0,0x88,0x04,0x04,0x88,0x70,0x00,/*"6",12*/ 0x10,0x1F,0x10,0x00,0x00,0x00,0x00,0x00,0x04,0xFC,0x04,0x04,0x04,0x04,0x0C,0x00,/*"L",0*/ 0x10,0x1F,0x11,0x11,0x17,0x10,0x08,0x00,0x04,0xFC,0x04,0x04,0xC4,0x04,0x18,0x00,/*"E",1*/ 0x00,0x00,0x03,0x1C,0x07,0x00,0x00,0x00,0x04,0x3C,0xC4,0x40,0x40,0xE4,0x1C,0x04,/*"A",2*/ 0x10,0x1F,0x11,0x11,0x11,0x11,0x0E,0x00,0x04,0xFC,0x04,0x00,0xC0,0x30,0x0C,0x04,/*"R",3*/ 0x10,0x1F,0x0C,0x03,0x00,0x10,0x1F,0x10,0x04,0xFC,0x04,0x00,0xE0,0x18,0xFC,0x00,/*"N",4*/ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,/*" ",5*/ 0x00,0x0E,0x11,0x10,0x10,0x10,0x1C,0x00,0x00,0x1C,0x04,0x84,0x84,0x44,0x38,0x00,/*"S",6*/ 0x18,0x10,0x10,0x1F,0x10,0x10,0x18,0x00,0x00,0x00,0x04,0xFC,0x04,0x00,0x00,0x00,/*"T",7*/ 0x00,0x00,0x03,0x1C,0x07,0x00,0x00,0x00,0x04,0x3C,0xC4,0x40,0x40,0xE4,0x1C,0x04,/*"A",8*/ 0x10,0x1F,0x11,0x11,0x11,0x11,0x0E,0x00,0x04,0xFC,0x04,0x00,0xC0,0x30,0x0C,0x04,/*"R",9*/ 0x18,0x10,0x10,0x1F,0x10,0x10,0x18,0x00,0x00,0x00,0x04,0xFC,0x04,0x00,0x00,0x00,/*"T",10*/ 0x00,0x00,0x00,0x1F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xCC,0x0C,0x00,0x00,0x00,/*"!",11*/ };
//16*16 字写函数 void LCD_P16x16Ch(u8 x,u8 y,u8 N) { u8 wm=0; u16 adder=32*N; LCD_Set_Pos(x , y); for(wm = 0;wm < 16;wm++) { OLED_WR_Byte(F16x16[adder],OLED_DATA); adder += 1; } LCD_Set_Pos(x,y-1); for(wm = 0;wm < 16;wm++) { OLED_WR_Byte(F16x16[adder],OLED_DATA); adder += 1; } } //8*16 字符写函数 void LCD_P8x16Ch(u8 x,u8 y,u8 N) { u8 wm=0; u16 adder=16*N; LCD_Set_Pos(x , y); for(wm = 0;wm < 8;wm++) { OLED_WR_Byte(F8x16[adder],OLED_DATA); adder += 1; } LCD_Set_Pos(x,y-1); for(wm = 0;wm < 8;wm++) { OLED_WR_Byte(F8x16[adder],OLED_DATA); adder += 1; } }
void OLED_Init(void) { GPIO_InitTypeDef GPIO_InitStructure; RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA, ENABLE); //使能PC,D,G端口时钟 GPIO_InitStructure.GPIO_Pin = GPIO_Pin_0|GPIO_Pin_1|GPIO_Pin_2|GPIO_Pin_3|GPIO_Pin_4; //PD3,PD6推挽输出 GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP; //推挽输出 GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;//速度50MHz GPIO_Init(GPIOA, &GPIO_InitStructure); //初始化GPIOD3,6 OLED_RST_Clr(); delay_ms(100); OLED_RST_Set(); OLED_WR_Byte(0xAE,OLED_CMD); //关闭显示 OLED_WR_Byte(0xD5,OLED_CMD); //设置时钟分频因子,震荡频率 OLED_WR_Byte(80,OLED_CMD); //[3:0],分频因子;[7:4],震荡频率 OLED_WR_Byte(0xA8,OLED_CMD); //设置驱动路数 OLED_WR_Byte(0X3F,OLED_CMD); //默认0X3F(1/64) OLED_WR_Byte(0xD3,OLED_CMD); //设置显示偏移 OLED_WR_Byte(0X00,OLED_CMD); //默认为0 OLED_WR_Byte(0x40,OLED_CMD); //设置显示开始行 [5:0],行数. OLED_WR_Byte(0x8D,OLED_CMD); //电荷泵设置 OLED_WR_Byte(0x14,OLED_CMD); //bit2,开启/关闭 OLED_WR_Byte(0x20,OLED_CMD); //设置内存地址模式 OLED_WR_Byte(0x02,OLED_CMD); //[1:0],00,列地址模式;01,行地址模式;10,页地址模式;默认10; OLED_WR_Byte(0xA1,OLED_CMD); //段重定义设置,bit0:0,0->0;1,0->127; OLED_WR_Byte(0xC0,OLED_CMD); //设置COM扫描方向;bit3:0,普通模式;1,重定义模式 COM[N-1]->COM0;N:驱动路数 OLED_WR_Byte(0xDA,OLED_CMD); //设置COM硬件引脚配置 OLED_WR_Byte(0x12,OLED_CMD); //[5:4]配置 OLED_WR_Byte(0x81,OLED_CMD); //对比度设置 OLED_WR_Byte(0xEF,OLED_CMD); //1~255;默认0X7F (亮度设置,越大越亮) OLED_WR_Byte(0xD9,OLED_CMD); //设置预充电周期 OLED_WR_Byte(0xf1,OLED_CMD); //[3:0],PHASE 1;[7:4],PHASE 2; OLED_WR_Byte(0xDB,OLED_CMD); //设置VCOMH 电压倍率 OLED_WR_Byte(0x30,OLED_CMD); //[6:4] 000,0.65*vcc;001,0.77*vcc;011,0.83*vcc; OLED_WR_Byte(0xA4,OLED_CMD); //全局显示开启;bit0:1,开启;0,关闭;(白屏/黑屏) OLED_WR_Byte(0xA6,OLED_CMD); //设置显示方式;bit0:1,反相显示;0,正常显示 OLED_WR_Byte(0xAF,OLED_CMD); //开启显示 OLED_Clear(); }
1. 使用 1 根 5P 杜邦线连接核心板 PA0~PA4 与 JP51(D0,D1,RES,DC,CS); 2. 在KEIL软件中调试运行“OLED屏显示”工程文件; 3. 实验现象:在OLED屏上显示 汉字和字符。
1. 按上述步骤调试出结果; 2. 利用字模软件生成字模数据,通过修改程序在OLED屏上显示如下内容: 第1行,学号 第2行,姓名 第3行,班级名字 第4行,STM32嵌入式实训 3. 让上述内容滚动显示(水平滚动,水平垂直滚动任选)。
任务2:
第1步:用字模软件生成需要用到的汉字和字符,将数据存入 oled.c 中。
u8 const F16x16[] = { 0x04,0x24,0x24,0x24,0x7F,0xC4,0x44,0x04,0x04,0xFF,0x04,0x44,0x34,0x05,0x04,0x00, 0x00,0x10,0x12,0x21,0xFE,0x40,0x82,0x02,0x04,0xC8,0x30,0x28,0x44,0x82,0x1F,0x00,/*内容:"我",索引:0*/ 0x00,0x1F,0x30,0xD0,0x10,0x10,0x1F,0x02,0x0C,0xF1,0x10,0x10,0x10,0x1F,0x00,0x00, 0x00,0xFE,0x84,0x84,0x84,0x84,0xFE,0x00,0x00,0x00,0xC2,0x01,0x02,0xFC,0x00,0x00,/*内容:"的",索引:1*/ 0x00,0x04,0x04,0x08,0x10,0x28,0xE6,0x21,0x22,0x24,0x28,0x30,0x00,0x00,0x00,0x00, 0x20,0x20,0x20,0x40,0x7F,0xC2,0xC2,0x42,0x42,0x42,0x42,0x42,0x7F,0x00,0x00,0x00,/*内容:"名",索引:2*/ 0x08,0x30,0x20,0x24,0x24,0x24,0xA4,0x64,0x25,0x26,0x24,0x20,0x20,0x28,0x30,0x00, 0x40,0x40,0x40,0x40,0x40,0x42,0x41,0xFE,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x00,/*内容:"字",索引:3*/ 0x21,0x21,0x3F,0x21,0x21,0x00,0x1F,0x00,0xFF,0x00,0x21,0x21,0x3F,0x21,0x21,0x00, 0x08,0x0C,0xF8,0x10,0x11,0x42,0x84,0x18,0xE0,0x00,0x04,0x04,0xFC,0x04,0x04,0x00,/*内容:"班",索引:4*/ 0x04,0x0C,0x35,0xC6,0x0C,0x00,0x40,0x40,0x7F,0x40,0x40,0x46,0x5A,0x63,0x00,0x00, 0x44,0xE6,0x44,0x48,0x48,0x02,0x0C,0xF1,0x01,0xC2,0x34,0x08,0x34,0xC2,0x01,0x00,/*内容:"级",索引:5*/ 0x01,0x01,0x77,0x11,0x11,0x11,0x17,0xF1,0x10,0x11,0x1E,0x12,0x72,0x02,0x03,0x00, 0x00,0x00,0xFE,0x24,0x24,0x24,0xFE,0x00,0x81,0x02,0x0C,0xF0,0x0C,0x82,0x01,0x00,/*内容:"嵌",索引:6*/ 0x00,0x00,0x00,0x00,0x00,0x80,0x47,0x38,0x07,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x01,0x02,0x04,0x08,0x30,0xC0,0x00,0x00,0x00,0xC0,0x30,0x0C,0x02,0x01,0x01,0x00,/*内容:"入",索引:7*/ 0x08,0x08,0x09,0x09,0x09,0x09,0x09,0x08,0x08,0xFF,0x08,0x08,0x88,0x68,0x08,0x00, 0x00,0x04,0x06,0x04,0xFC,0x08,0x08,0x08,0x00,0xC0,0x30,0x08,0x04,0x02,0x1F,0x00,/*内容:"式",索引:8*/ 0x00,0x00,0x44,0x4C,0x54,0x65,0x45,0x46,0x84,0x88,0x90,0x81,0x80,0x00,0x00,0x00, 0x00,0x42,0x44,0xC8,0xD0,0x42,0x41,0x7E,0x40,0x40,0x50,0x48,0xC4,0x62,0x00,0x00,/*内容:"系",索引:9*/ 0x04,0x0C,0x35,0xC6,0x0C,0x00,0x11,0x13,0x15,0x99,0x71,0x11,0x15,0x13,0x11,0x00, 0x44,0xE6,0x44,0x48,0x48,0x01,0x02,0x0C,0xF0,0x00,0x00,0xFC,0x02,0x02,0x8E,0x00,/*内容:"统",索引:10*/ 0x08,0x30,0x20,0x21,0x28,0x26,0xA0,0x60,0x2F,0x20,0x20,0x20,0x20,0x28,0x30,0x00, 0x20,0x21,0x21,0x22,0xE2,0x24,0x28,0x30,0xE0,0x30,0x28,0x24,0x22,0x21,0x20,0x00,/*内容:"实",索引:11*/ 0x02,0x02,0x42,0x33,0x00,0x00,0x00,0xFF,0x00,0x00,0x7F,0x00,0x00,0xFF,0x00,0x00, 0x00,0x00,0x00,0xFC,0x08,0x11,0x06,0xF8,0x00,0x00,0xFC,0x00,0x00,0xFF,0x00,0x00,/*内容:"训",索引:12*/ }; u8 const F8x16[] = { 0x00,0x07,0x08,0x10,0x10,0x08,0x07,0x00,0x00,0xF0,0x08,0x04,0x04,0x08,0xF0,0x00,/*内容:"0",索引:0*/ 0x00,0x00,0x08,0x08,0x1F,0x00,0x00,0x00,0x00,0x00,0x04,0x04,0xFC,0x04,0x04,0x00,/*内容:"1",索引:1*/ 0x00,0x0E,0x10,0x10,0x10,0x10,0x0F,0x00,0x00,0x0C,0x14,0x24,0x44,0x84,0x0C,0x00,/*内容:"2",索引:2*/ 0x00,0x0C,0x10,0x10,0x10,0x11,0x0E,0x00,0x00,0x18,0x04,0x84,0x84,0x44,0x38,0x00,/*内容:"3",索引:3*/ 0x00,0x00,0x01,0x02,0x0C,0x1F,0x00,0x00,0x00,0x60,0xA0,0x24,0x24,0xFC,0x24,0x24,/*内容:"4",索引:4*/ 0x00,0x1F,0x11,0x11,0x11,0x10,0x10,0x00,0x00,0x98,0x04,0x04,0x04,0x88,0x70,0x00,/*内容:"5",索引:5*/ 0x00,0x07,0x08,0x11,0x11,0x09,0x00,0x00,0x00,0xF0,0x88,0x04,0x04,0x04,0xF8,0x00,/*内容:"6",索引:6*/ 0x00,0x18,0x10,0x10,0x11,0x16,0x18,0x00,0x00,0x00,0x00,0x7C,0x80,0x00,0x00,0x00,/*内容:"7",索引:7*/ 0x00,0x0E,0x11,0x10,0x10,0x11,0x0E,0x00,0x00,0x38,0x44,0x84,0x84,0x44,0x38,0x00,/*内容:"8",索引:8*/ 0x00,0x0F,0x10,0x10,0x10,0x08,0x07,0x00,0x00,0x80,0x48,0x44,0x44,0x88,0xF0,0x00,/*内容:"9",索引:9*/ 0x00,0x0E,0x11,0x10,0x10,0x10,0x1C,0x00,0x00,0x1C,0x04,0x84,0x84,0x44,0x38,0x00,/*内容:"S",索引:10*/ 0x18,0x10,0x10,0x1F,0x10,0x10,0x18,0x00,0x00,0x00,0x04,0xFC,0x04,0x00,0x00,0x00,/*内容:"T",索引:11*/ 0x10,0x1F,0x1F,0x00,0x1F,0x1F,0x10,0x00,0x04,0xFC,0x80,0x7C,0x80,0xFC,0x04,0x00,/*内容:"M",索引:12*/ };
第2步:在主函数中修改显示代码如下
int main(void) { /* 设置系统时钟为72M */ SystemInit(); OLED_Init(); //初始化OLED // 由左下往右上,(列(间隔:字符8bit,字16bit),行(间隔:2),索引(查字模数据)) // 第 4 行 LCD_P8x16Ch(0,1,10); // S LCD_P8x16Ch(8,1,11); // T LCD_P8x16Ch(16,1,12); // M LCD_P8x16Ch(24,1,3); // 3 LCD_P8x16Ch(32,1,2); // 2 LCD_P16x16Ch(40,1,6); // 嵌 LCD_P16x16Ch(56,1,7); // 入 LCD_P16x16Ch(72,1,8); // 式 LCD_P16x16Ch(88,1,9); // 系 LCD_P16x16Ch(106,1,10); // 统 // 第 3 行 LCD_P16x16Ch(0,3,0); // 我 LCD_P16x16Ch(16,3,1); // 的 LCD_P16x16Ch(32,3,4); // 班 LCD_P16x16Ch(48,3,5); // 级 // 第 2 行 LCD_P16x16Ch(0,5,0); // 我 LCD_P16x16Ch(16,5,1); // 的 LCD_P16x16Ch(32,5,2); // 名 LCD_P16x16Ch(48,5,3); // 字 // 第 1 行 LCD_P8x16Ch(0,7,2); // 2 LCD_P8x16Ch(8,7,0); // 0 LCD_P8x16Ch(16,7,2); // 2 LCD_P8x16Ch(24,7,0); // 0 LCD_P8x16Ch(32,7,9); // 9 LCD_P8x16Ch(40,7,5); // 5 LCD_P8x16Ch(48,7,2); // 2 LCD_P8x16Ch(56,7,7); // 7 LCD_P8x16Ch(64,7,2); // 2 LCD_P8x16Ch(72,7,7); // 7 while (1) { ; } }
任务3:
参考文档《内部SSD1306驱动芯片手册》第29页,在主函数中插入如下代码:
OLED_Clear(); OLED_WR_Byte(0x2e, OLED_CMD); // 关闭滚动 // 参考文档说明,指定滚动类型后紧跟5条指令 OLED_WR_Byte(0x29, OLED_CMD); // 滚动类型26h/27h/29h/2ah OLED_WR_Byte(0x00, OLED_CMD); // 虚拟字节 OLED_WR_Byte(0x00, OLED_CMD); // 滚动起始页(水平) OLED_WR_Byte(0x00, OLED_CMD); // 滚动的时间间隔(越大滚动越慢) OLED_WR_Byte(0x01, OLED_CMD); // 滚动终止页(水平) OLED_WR_Byte(0x3f, OLED_CMD); // 垂直滚动偏移量 0x01~0x3f,从第1~63行开始滚动: // 0x01对应由上往下滚动,0x3f对应由下往上滚动 此处放“任务2_main.c”中的显示内容...... OLED_WR_Byte(0x2F, OLED_CMD); // 开启滚动