滚动方式
水平滚动
OLED_WR_Byte(0x2E,OLED_CMD);
OLED_WR_Byte(0x26,OLED_CMD);
OLED_WR_Byte(0x00,OLED_CMD);
OLED_WR_Byte(0x00,OLED_CMD);
OLED_WR_Byte(0x07,OLED_CMD);
OLED_WR_Byte(0x07,OLED_CMD);
OLED_WR_Byte(0x00,OLED_CMD);
OLED_WR_Byte(0xFF,OLED_CMD);
OLED_WR_Byte(0x2F,OLED_CMD);
水平加垂直滚动
OLED_WR_Byte(0x2e,OLED_CMD);
OLED_WR_Byte(0x29,OLED_CMD);
OLED_WR_Byte(0x00,OLED_CMD);
OLED_WR_Byte(0x00,OLED_CMD);
OLED_WR_Byte(0x07,OLED_CMD);
OLED_WR_Byte(0x07,OLED_CMD);
OLED_WR_Byte(0x01,OLED_CMD);
OLED_WR_Byte(0x2F,OLED_CMD);
一、文字取模
获取对应的16进制点阵表示
插入oledfont.h中
"今",0x01,0x00,0x01,0x00,0x02,0x80,0x04,0x40,0x08,0x20,0x12,0x10,0x21,0x08,0xC1,0x06,
0x00,0x00,0x1F,0xF0,0x00,0x10,0x00,0x20,0x00,0x20,0x00,0x40,0x00,0x80,0x01,0x00,
"晚",0x00,0x80,0x00,0x80,0x79,0xF8,0x4A,0x08,0x4C,0x10,0x4B,0xFC,0x4A,0x44,0x7A,0x44,
0x4A,0x44,0x4B,0xFC,0x48,0xA0,0x48,0xA0,0x79,0x22,0x49,0x22,0x02,0x1E,0x04,0x00,
"月",0x00,0x00,0x1F,0xF8,0x10,0x08,0x10,0x08,0x10,0x08,0x1F,0xF8,0x10,0x08,0x10,0x08,
0x10,0x08,0x1F,0xF8,0x10,0x08,0x10,0x08,0x20,0x08,0x20,0x08,0x40,0x28,0x80,0x10,
"色",0x08,0x00,0x08,0x00,0x1F,0xE0,0x20,0x20,0x40,0x40,0xBF,0xF8,0x21,0x08,0x21,0x08,
0x21,0x08,0x3F,0xF8,0x20,0x00,0x20,0x02,0x20,0x02,0x20,0x02,0x1F,0xFE,0x00,0x00,
"真",0x01,0x00,0x01,0x00,0x7F,0xFC,0x01,0x00,0x1F,0xF0,0x10,0x10,0x1F,0xF0,0x10,0x10,
0x1F,0xF0,0x10,0x10,0x1F,0xF0,0x10,0x10,0xFF,0xFE,0x08,0x20,0x10,0x10,0x20,0x08,
"美",0x08,0x20,0x04,0x40,0x7F,0xFC,0x01,0x00,0x01,0x00,0x3F,0xF8,0x01,0x00,0x01,0x00,
0xFF,0xFE,0x01,0x00,0x01,0x00,0x7F,0xFC,0x02,0x80,0x04,0x40,0x18,0x30,0xE0,0x0E,
二、代码修改
text.c 中的
void TEST_MainPage(void)
{
GUI_ShowCHinese(10,20,16,"今晚月色真美",1);
delay_ms(1500);
delay_ms(1500);
}
主函数main
#include "delay.h"
#include "sys.h"
#include "oled.h"
#include "gui.h"
#include "test.h"
int main(void)
{
delay_init();
NVIC_Configuration();
OLED_Init();
OLED_Clear(0);
OLED_WR_Byte(0x2e,OLED_CMD);
OLED_WR_Byte(0x29,OLED_CMD);
OLED_WR_Byte(0x00,OLED_CMD);
OLED_WR_Byte(0x00,OLED_CMD);
OLED_WR_Byte(0x07,OLED_CMD);
OLED_WR_Byte(0x07,OLED_CMD);
OLED_WR_Byte(0x01,OLED_CMD);
TEST_MainPage();
OLED_WR_Byte(0x2F,OLED_CMD);
while(1)
{}
}
三、硬件连接加结果
OLEDM模块 | STM32单片机 |
---|
VCC | DC 5V/3.3V | GND | GND | D1 | PB15 | CS | PB11 | RES | PB12 | DC | PB10 | D0 | PB13 |
总结
以上就是本次实验的内容,实现OLED的滚动显示
参考文献
0.96寸OLED 在STM32实现滚动显示
|