*部分IIC函数需参考上篇内容IIC协议
128 * 64 点阵
步骤:
/*
1. start()
2. 写入 b0111 1000 0x78
3. ACK
4. cotrol byte: (0)(0)000000 写入命令 (0)(1)000000写入数据
5. ACK
6. 写入指令/数据
7. ACK
8. STOP
*/
写命令
void Oled_Write_Cmd(char cmd)
{
// 1. start()
IIC_Start();
// 2. 写入从机地址 b0111 1000 0x78
IIC_Send_Byte(0x78);
// 3. ACK
IIC_ACK();
// 4. cotrol byte: (0)(0)000000 写入命令 (0)(1)000000写入数据
IIC_Send_Byte(0x00);
// 5. ACK
IIC_ACK();
//6. 写入指令/数据
IIC_Send_Byte(cmd);
//7. ACK
IIC_ACK();
//8. STOP
IIC_Stop();
}
写数据
void Oled_Write_Cmd(char data)
{
// 1. start()
IIC_Start();
// 2. 写入从机地址 b0111 1000 0x78
IIC_Send_Byte(0x78);
// 3. ACK
IIC_ACK();
// 4. cotrol byte: (0)(0)000000 写入命令 (0)(1)000000写入数据
IIC_Send_Byte(0x40);
// 5. ACK
IIC_ACK();
//6. 写入指令/数据
IIC_Send_Byte(data);
//7. ACK
IIC_ACK();
//8. STOP
IIC_Stop();
}
OLED有三种寻址模式,分别为页地址模式(常用),水平地址模式和垂直地址模式
1、发送cmd:0x20;
2、发送cmd:0x02;
水平地址模式
垂直地址模式
列地址选择
确定page:10110XXX(后三位,2的三次方,8页)
page0:10110000
page1:10110001
OLED初始化
void Oled_Init(void)
{
Oled_Write_Cmd(0xAE);//--display off
Oled_Write_Cmd(0x00);//---set low column address
Oled_Write_Cmd(0x10);//---set high column address
Oled_Write_Cmd(0x40);//--set start line address
Oled_Write_Cmd(0xB0);//--set page address
Oled_Write_Cmd(0x81); // contract control
Oled_Write_Cmd(0xFF);//--128
Oled_Write_Cmd(0xA1);//set segment remap
Oled_Write_Cmd(0xA6);//--normal / reverse
Oled_Write_Cmd(0xA8);//--set multiplex ratio(1 to 64)
Oled_Write_Cmd(0x3F);//--1/32 duty
Oled_Write_Cmd(0xC8);//Com scan direction
Oled_Write_Cmd(0xD3);//-set display offset
Oled_Write_Cmd(0x00);//
Oled_Write_Cmd(0xD5);//set osc division
Oled_Write_Cmd(0x80);//
Oled_Write_Cmd(0xD8);//set area color mode off
Oled_Write_Cmd(0x05);//
Oled_Write_Cmd(0xD9);//Set Pre-Charge Period
Oled_Write_Cmd(0xF1);//
Oled_Write_Cmd(0xDA);//set com pin configuartion
Oled_Write_Cmd(0x12);//
Oled_Write_Cmd(0xDB);//set Vcomh
Oled_Write_Cmd(0x30);//
Oled_Write_Cmd(0x8D);//set charge pump enable
Oled_Write_Cmd(0x14);//
Oled_Write_Cmd(0xAF);//--turn on oled panel
}
步骤:
1、OLED初始化
2、选择一个位置
2.1确认页寻址模式
2.2选择PAGE0
3、显示一个点
void main()
{
//1、OLED初始化
Oled_Init();
//2、选择一个位置
//2.1确认页寻址模式
Oled_Write_Cmd(0x20);
Oled_Write_Cmd(0x02);
//2.2选择PAGE0 1011 0000
Oled_Write_Cmd(0xB0);
//3、显示一个点
Oled_Write_Cmd(0x08);
}
4、显示字母A
#include "reg52.h"
#include "intrins.h"
sbit scl = P0^1;
sbit sda = P0^3;
void IIC_Start()
{
scl = 0;
sda = 1;
scl = 1;
_nop_();
sda = 0;
_nop_();
}
void IIC_Stop()
{
scl = 0;
sda = 0;
scl = 1;
_nop_();
sda = 1;
_nop_();
}
char IIC_ACK()
{
char flag;
sda = 1;//就在时钟脉冲9期间释放数据线
_nop_();
scl = 1;
_nop_();
flag = sda;
_nop_();
scl = 0;
_nop_();
return flag;
}
void IIC_Send_Byte(char dataSend)
{
int i;
for(i = 0;i<8;i++){
scl = 0;//scl拉低,让sda做好数据准备
sda = dataSend & 0x80;//1000 0000获得dataSend的最高位,给sda
_nop_();//发送数据建立时间
scl = 1;//scl拉高开始发送
_nop_();//数据发送时间
scl = 0;//发送完毕拉低
_nop_();//
dataSend = dataSend << 1;
}
}
void Oled_Write_Cmd(char dataCmd)
{
// 1. start()
IIC_Start();
//
// 2. 写入从机地址 b0111 1000 0x78
IIC_Send_Byte(0x78);
// 3. ACK
IIC_ACK();
// 4. cotrol byte: (0)(0)000000 写入命令 (0)(1)000000写入数据
IIC_Send_Byte(0x00);
// 5. ACK
IIC_ACK();
//6. 写入指令/数据
IIC_Send_Byte(dataCmd);
//7. ACK
IIC_ACK();
//8. STOP
IIC_Stop();
}
void Oled_Write_Data(char dataData)
{
// 1. start()
IIC_Start();
//
// 2. 写入从机地址 b0111 1000 0x78
IIC_Send_Byte(0x78);
// 3. ACK
IIC_ACK();
// 4. cotrol byte: (0)(0)000000 写入命令 (0)(1)000000写入数据
IIC_Send_Byte(0x40);
// 5. ACK
IIC_ACK();
///6. 写入指令/数据
IIC_Send_Byte(dataData);
//7. ACK
IIC_ACK();
//8. STOP
IIC_Stop();
}
void Oled_Init(void)
{
Oled_Write_Cmd(0xAE);//--display off
Oled_Write_Cmd(0x00);//---set low column address
Oled_Write_Cmd(0x10);//---set high column address
Oled_Write_Cmd(0x40);//--set start line address
Oled_Write_Cmd(0xB0);//--set page address
Oled_Write_Cmd(0x81); // contract control
Oled_Write_Cmd(0xFF);//--128
Oled_Write_Cmd(0xA1);//set segment remap
Oled_Write_Cmd(0xA6);//--normal / reverse
Oled_Write_Cmd(0xA8);//--set multiplex ratio(1 to 64)
Oled_Write_Cmd(0x3F);//--1/32 duty
Oled_Write_Cmd(0xC8);//Com scan direction
Oled_Write_Cmd(0xD3);//-set display offset
Oled_Write_Cmd(0x00);//
Oled_Write_Cmd(0xD5);//set osc division
Oled_Write_Cmd(0x80);//
Oled_Write_Cmd(0xD8);//set area color mode off
Oled_Write_Cmd(0x05);//
Oled_Write_Cmd(0xD9);//Set Pre-Charge Period
Oled_Write_Cmd(0xF1);//
Oled_Write_Cmd(0xDA);//set com pin configuartion
Oled_Write_Cmd(0x12);//
Oled_Write_Cmd(0xDB);//set Vcomh
Oled_Write_Cmd(0x30);//
Oled_Write_Cmd(0x8D);//set charge pump enable
Oled_Write_Cmd(0x14);//
Oled_Write_Cmd(0xAF);//--turn on oled panel
}
void Oled_Clear()
{
int i, j;
for(i=0;i<8;i++)
{
Oled_Write_Cmd(0xB0+i);//page0--page7
//每个page从0列
Oled_Write_Cmd(0x00);
Oled_Write_Cmd(0x10);
//一共有128列,0~127
for(j=0;j<128;j++)
{
Oled_Write_Data(0);
}
}
}
/*-- 文字: A --*/
/*-- 宋体12; 此字体下对应的点阵为:宽x高=8x16 --*/
char A1[8] = {0x00,0x00,0xC0,0x38,0xE0,0x00,0x00,0x00};
char A2[8] = {0x20,0x3C,0x23,0x02,0x02,0x27,0x38,0x20};
void main()
{
int i;
//1、OLED初始化
Oled_Init();
//2、选择一个位置
//2.1确认页寻址模式
Oled_Write_Cmd(0x20);
Oled_Write_Cmd(0x02);
Oled_Clear();
//2.2选择PAGE0
Oled_Write_Cmd(0xB0);
Oled_Write_Cmd(0x00);
Oled_Write_Cmd(0x10);
for(i=0;i<8;i++){
Oled_Write_Data(A1[i]);
}
Oled_Write_Cmd(0xB1);
Oled_Write_Cmd(0x00);
Oled_Write_Cmd(0x10);
for(i=0;i<8;i++){
Oled_Write_Data(A2[i]);
}
while(1);
}
5、显示汉字
#include "reg52.h"
#include "intrins.h"
sbit scl = P0^1;
sbit sda = P0^3;
void IIC_Start()
{
scl = 0;
sda = 1;
scl = 1;
_nop_();
sda = 0;
_nop_();
}
void IIC_Stop()
{
scl = 0;
sda = 0;
scl = 1;
_nop_();
sda = 1;
_nop_();
}
char IIC_ACK()
{
char flag;
sda = 1;//就在时钟脉冲9期间释放数据线
_nop_();
scl = 1;
_nop_();
flag = sda;
_nop_();
scl = 0;
_nop_();
return flag;
}
void IIC_Send_Byte(char dataSend)
{
int i;
for(i = 0;i<8;i++){
scl = 0;//scl拉低,让sda做好数据准备
sda = dataSend & 0x80;//1000 0000获得dataSend的最高位,给sda
_nop_();//发送数据建立时间
scl = 1;//scl拉高开始发送
_nop_();//数据发送时间
scl = 0;//发送完毕拉低
_nop_();//
dataSend = dataSend << 1;
}
}
void Oled_Write_Cmd(char dataCmd)
{
// 1. start()
IIC_Start();
//
// 2. 写入从机地址 b0111 1000 0x78
IIC_Send_Byte(0x78);
// 3. ACK
IIC_ACK();
// 4. cotrol byte: (0)(0)000000 写入命令 (0)(1)000000写入数据
IIC_Send_Byte(0x00);
// 5. ACK
IIC_ACK();
//6. 写入指令/数据
IIC_Send_Byte(dataCmd);
//7. ACK
IIC_ACK();
//8. STOP
IIC_Stop();
}
void Oled_Write_Data(char dataData)
{
// 1. start()
IIC_Start();
//
// 2. 写入从机地址 b0111 1000 0x78
IIC_Send_Byte(0x78);
// 3. ACK
IIC_ACK();
// 4. cotrol byte: (0)(0)000000 写入命令 (0)(1)000000写入数据
IIC_Send_Byte(0x40);
// 5. ACK
IIC_ACK();
///6. 写入指令/数据
IIC_Send_Byte(dataData);
//7. ACK
IIC_ACK();
//8. STOP
IIC_Stop();
}
void Oled_Init(void)
{
Oled_Write_Cmd(0xAE);//--display off
Oled_Write_Cmd(0x00);//---set low column address
Oled_Write_Cmd(0x10);//---set high column address
Oled_Write_Cmd(0x40);//--set start line address
Oled_Write_Cmd(0xB0);//--set page address
Oled_Write_Cmd(0x81); // contract control
Oled_Write_Cmd(0xFF);//--128
Oled_Write_Cmd(0xA1);//set segment remap
Oled_Write_Cmd(0xA6);//--normal / reverse
Oled_Write_Cmd(0xA8);//--set multiplex ratio(1 to 64)
Oled_Write_Cmd(0x3F);//--1/32 duty
Oled_Write_Cmd(0xC8);//Com scan direction
Oled_Write_Cmd(0xD3);//-set display offset
Oled_Write_Cmd(0x00);//
Oled_Write_Cmd(0xD5);//set osc division
Oled_Write_Cmd(0x80);//
Oled_Write_Cmd(0xD8);//set area color mode off
Oled_Write_Cmd(0x05);//
Oled_Write_Cmd(0xD9);//Set Pre-Charge Period
Oled_Write_Cmd(0xF1);//
Oled_Write_Cmd(0xDA);//set com pin configuartion
Oled_Write_Cmd(0x12);//
Oled_Write_Cmd(0xDB);//set Vcomh
Oled_Write_Cmd(0x30);//
Oled_Write_Cmd(0x8D);//set charge pump enable
Oled_Write_Cmd(0x14);//
Oled_Write_Cmd(0xAF);//--turn on oled panel
}
void Oled_Clear()
{
int i, j;
for(i=0;i<8;i++)
{
Oled_Write_Cmd(0xB0+i);//page0--page7
//每个page从0列
Oled_Write_Cmd(0x00);
Oled_Write_Cmd(0x10);
//一共有128列,0~127
for(j=0;j<128;j++)
{
Oled_Write_Data(0);
}
}
}
/*-- 文字: 母 --*/
/*-- 宋体12; 此字体下对应的点阵为:宽x高=16x16 --*/
char w1[16] = {0x40,0x40,0xC0,0x7E,0x42,0x42,0x4A,0x72,0x42,0x42,0x42,0xFE,0x40,0x40,0x40,0x00};
char w2[16] = {0x00,0x00,0x0F,0x08,0x08,0x08,0x09,0x0E,0x48,0x88,0x48,0x3F,0x08,0x08,0x00,0x00};
/*-- 文字: 亲 --*/
/*-- 宋体12; 此字体下对应的点阵为:宽x高=16x16 --*/
char y1[16] = {0x40,0x40,0x44,0x44,0x54,0x64,0x45,0xC6,0x44,0x64,0x54,0x44,0x44,0x40,0x40,0x00};
char y2[16] = {0x00,0x42,0x22,0x12,0x0A,0x42,0x82,0x7F,0x02,0x02,0x0A,0x12,0x22,0x42,0x00,0x00};
/*-- 文字: 节 --*/
/*-- 宋体12; 此字体下对应的点阵为:宽x高=16x16 --*/
code char a1[16] = {0x04,0x44,0x44,0x44,0x5F,0x44,0xC4,0x44,0x44,0x44,0x5F,0x44,0xC4,0x04,0x04,0x00};
code char a2[16] = {0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0x00,0x00,0x08,0x10,0x08,0x07,0x00,0x00,0x00};
/*-- 文字: 快 --*/
/*-- 宋体12; 此字体下对应的点阵为:宽x高=16x16 --*/
code char d1[16] = {0x00,0xE0,0x00,0xFF,0x10,0x20,0x08,0x08,0x08,0xFF,0x08,0x08,0xF8,0x00,0x00,0x00};
code char d2[16] = {0x01,0x00,0x00,0xFF,0x00,0x81,0x41,0x31,0x0D,0x03,0x0D,0x31,0x41,0x81,0x81,0x00};
/*-- 文字: 乐 --*/
/*-- 宋体12; 此字体下对应的点阵为:宽x高=16x16 --*/
code char h1[16] = {0x00,0x00,0xE0,0x9C,0x84,0x84,0x84,0xF4,0x82,0x82,0x83,0x82,0x80,0x80,0x00,0x00};
code char h2[16] = {0x00,0x20,0x10,0x08,0x06,0x40,0x80,0x7F,0x00,0x00,0x02,0x04,0x08,0x30,0x00,0x00};
/*-- 文字: ! --*/
/*-- 宋体12; 此字体下对应的点阵为:宽x高=16x16 --*/
code char g1[16] = {0x00,0x00,0x00,0xFE,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};
code char g2[16] = {0x00,0x00,0x00,0x33,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};
void main()
{
int i;
//1、OLED初始化
Oled_Init();
//2、选择一个位置
//2.1确认页寻址模式
Oled_Write_Cmd(0x20);
Oled_Write_Cmd(0x02);
Oled_Clear();
//2.2选择PAGE0
Oled_Write_Cmd(0xB0);
Oled_Write_Cmd(0x00);
Oled_Write_Cmd(0x10);
for(i=0;i<16;i++){
Oled_Write_Data(w1[i]);
}
for(i=0;i<16;i++){
Oled_Write_Data(y1[i]);
}
for(i=0;i<16;i++){
Oled_Write_Data(a1[i]);
}
for(i=0;i<16;i++){
Oled_Write_Data(d1[i]);
}
for(i=0;i<16;i++){
Oled_Write_Data(h1[i]);
}
for(i=0;i<16;i++){
Oled_Write_Data(g1[i]);
}
Oled_Write_Cmd(0xB1);
Oled_Write_Cmd(0x00);
Oled_Write_Cmd(0x10);
for(i=0;i<16;i++){
Oled_Write_Data(w2[i]);
}
for(i=0;i<16;i++){
Oled_Write_Data(y2[i]);
}
for(i=0;i<16;i++){
Oled_Write_Data(a2[i]);
}
for(i=0;i<16;i++){
Oled_Write_Data(d2[i]);
}
for(i=0;i<16;i++){
Oled_Write_Data(h2[i]);
}
for(i=0;i<16;i++){
Oled_Write_Data(g2[i]);
}
while(1);
}
6、显示图片
#include "reg52.h"
#include "intrins.h"
sbit scl = P0^1;
sbit sda = P0^3;
void IIC_Start()
{
scl = 0;
sda = 1;
scl = 1;
_nop_();
sda = 0;
_nop_();
}
void IIC_Stop()
{
scl = 0;
sda = 0;
scl = 1;
_nop_();
sda = 1;
_nop_();
}
char IIC_ACK()
{
char flag;
sda = 1;//就在时钟脉冲9期间释放数据线
_nop_();
scl = 1;
_nop_();
flag = sda;
_nop_();
scl = 0;
_nop_();
return flag;
}
void IIC_Send_Byte(char dataSend)
{
int i;
for(i = 0;i<8;i++){
scl = 0;//scl拉低,让sda做好数据准备
sda = dataSend & 0x80;//1000 0000获得dataSend的最高位,给sda
_nop_();//发送数据建立时间
scl = 1;//scl拉高开始发送
_nop_();//数据发送时间
scl = 0;//发送完毕拉低
_nop_();//
dataSend = dataSend << 1;
}
}
void Oled_Write_Cmd(char dataCmd)
{
// 1. start()
IIC_Start();
//
// 2. 写入从机地址 b0111 1000 0x78
IIC_Send_Byte(0x78);
// 3. ACK
IIC_ACK();
// 4. cotrol byte: (0)(0)000000 写入命令 (0)(1)000000写入数据
IIC_Send_Byte(0x00);
// 5. ACK
IIC_ACK();
//6. 写入指令/数据
IIC_Send_Byte(dataCmd);
//7. ACK
IIC_ACK();
//8. STOP
IIC_Stop();
}
void Oled_Write_Data(char dataData)
{
// 1. start()
IIC_Start();
//
// 2. 写入从机地址 b0111 1000 0x78
IIC_Send_Byte(0x78);
// 3. ACK
IIC_ACK();
// 4. cotrol byte: (0)(0)000000 写入命令 (0)(1)000000写入数据
IIC_Send_Byte(0x40);
// 5. ACK
IIC_ACK();
///6. 写入指令/数据
IIC_Send_Byte(dataData);
//7. ACK
IIC_ACK();
//8. STOP
IIC_Stop();
}
void Oled_Init(void)
{
Oled_Write_Cmd(0xAE);//--display off
Oled_Write_Cmd(0x00);//---set low column address
Oled_Write_Cmd(0x10);//---set high column address
Oled_Write_Cmd(0x40);//--set start line address
Oled_Write_Cmd(0xB0);//--set page address
Oled_Write_Cmd(0x81); // contract control
Oled_Write_Cmd(0xFF);//--128
Oled_Write_Cmd(0xA1);//set segment remap
Oled_Write_Cmd(0xA6);//--normal / reverse
Oled_Write_Cmd(0xA8);//--set multiplex ratio(1 to 64)
Oled_Write_Cmd(0x3F);//--1/32 duty
Oled_Write_Cmd(0xC8);//Com scan direction
Oled_Write_Cmd(0xD3);//-set display offset
Oled_Write_Cmd(0x00);//
Oled_Write_Cmd(0xD5);//set osc division
Oled_Write_Cmd(0x80);//
Oled_Write_Cmd(0xD8);//set area color mode off
Oled_Write_Cmd(0x05);//
Oled_Write_Cmd(0xD9);//Set Pre-Charge Period
Oled_Write_Cmd(0xF1);//
Oled_Write_Cmd(0xDA);//set com pin configuartion
Oled_Write_Cmd(0x12);//
Oled_Write_Cmd(0xDB);//set Vcomh
Oled_Write_Cmd(0x30);//
Oled_Write_Cmd(0x8D);//set charge pump enable
Oled_Write_Cmd(0x14);//
Oled_Write_Cmd(0xAF);//--turn on oled panel
}
void Oled_Clear()
{
int i, j;
for(i=0;i<8;i++)
{
Oled_Write_Cmd(0xB0+i);//page0--page7
//每个page从0列
Oled_Write_Cmd(0x00);
Oled_Write_Cmd(0x10);
//一共有128列,0~127
for(j=0;j<128;j++)
{
Oled_Write_Data(0);
}
}
}
/*-- 调入了一幅图像:D:\AAAAA\WY\51\22-IIC协议&OLED\04-IIC协议OLED显示图片\wm.bmp --*/
/*-- 宽度x高度=128x64 128*8--*/
code unsigned char bmp[] = {
0x00,0x00,0x80,0xC0,0xE0,0xF0,0xF0,0xF8,0xF8,0xF8,0xF8,0xF8,0xF8,0xF8,0xF0,0xF0,
0xF0,0xE0,0xE0,0x60,0x70,0x70,0x30,0x30,0x38,0x18,0x18,0x18,0x18,0x18,0x18,0x1C,
0x0C,0x1C,0x1C,0x1C,0x18,0x18,0x18,0x18,0x18,0x30,0x30,0x30,0x60,0x60,0xE0,0xE0,
0xE0,0xF0,0xF8,0xF8,0xF8,0xF8,0xF8,0xF8,0xF8,0xF8,0xF0,0xF0,0xE0,0xC0,0x80,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x3E,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x7F,0x1F,0x1F,0x07,0x07,0x03,
0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x01,0x01,0x03,0x07,0x0F,0x1F,0x3F,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x7F,
0x7F,0x00,0x00,0x00,0x00,0x00,0xF0,0xF0,0x70,0x30,0x30,0x30,0xF0,0xE0,0x00,0x00,
0x40,0xE0,0x70,0x30,0x30,0x30,0x70,0xF0,0xE0,0x00,0x00,0x00,0xF0,0xF0,0x70,0x30,
0x30,0x70,0xF0,0xE0,0x00,0x00,0xC0,0xE0,0x70,0x30,0x30,0x30,0x30,0x74,0xFF,0xFF,
0x00,0x00,0x00,0xE0,0xF0,0x30,0x30,0x30,0x70,0xF0,0xE0,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x03,0x07,0x0F,0x1F,0xFF,0xFF,0x0F,0x01,0x00,0x00,0x00,0x80,0xE0,0xF0,
0xF8,0xF8,0xFC,0xFC,0x7E,0x7E,0x7E,0xFE,0xFC,0xF8,0x60,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x20,0xF8,0xFC,0xFC,0xFE,0x7E,0xFE,0xFC,0xF8,
0xF8,0xF0,0xE0,0x80,0x00,0x00,0x00,0x01,0x0F,0xFF,0xFF,0x1F,0x0F,0x07,0x03,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0x60,0x60,0xE0,0x60,0x7F,0x3F,0x02,0x00,
0x38,0x7D,0xFE,0x66,0xE6,0x66,0x76,0x7F,0x7F,0x00,0x00,0x00,0x7F,0x7F,0x00,0x00,
0x00,0x00,0x7F,0x7F,0x00,0x00,0x1F,0x3F,0x7A,0x60,0xE0,0xE0,0x60,0x78,0x7F,0x7F,
0x00,0x00,0x38,0x7D,0x7F,0xE6,0x46,0x66,0x76,0x7F,0x7F,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0xFF,0xE0,0x00,0x00,0x00,0x3E,0xFF,0xFF,0xFF,
0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x7F,0x1F,0x03,0x00,0x00,0x00,0x60,0xF0,0xF8,
0xF8,0xF8,0xF0,0xF0,0x70,0x00,0x00,0x00,0x07,0x3F,0x7F,0xFF,0xFF,0xFF,0xFF,0xFF,
0xFF,0xFF,0xFF,0xFF,0x7F,0x00,0x00,0x80,0xE0,0xFF,0x3F,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x07,0x07,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x03,0x0F,0x1C,0x38,0x60,0xE0,0xC1,0x81,
0x83,0x03,0x03,0x01,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x03,0x03,0x83,
0x83,0x83,0xC1,0xE0,0x70,0x38,0x1C,0x0F,0x03,0x80,0x80,0xA0,0xB0,0xB8,0xFC,0xF7,
0xF7,0x92,0x94,0xDC,0xF8,0xD0,0xC0,0x40,0x00,0x00,0x00,0xC0,0xC2,0x46,0xFC,0x40,
0x00,0x10,0x70,0xC7,0x9E,0xC0,0xFE,0x1C,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0xF0,
0xA0,0xB0,0xB3,0xFF,0xB2,0x90,0xB0,0xF0,0x38,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x80,0x80,0x84,0x84,0x84,0x86,0xB6,0xE6,0x96,0x8E,0x86,0x86,0xC0,0xC0,0x80,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,
0x3F,0xFF,0xFF,0x7F,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0x7C,0x0C,0x0C,0x0C,0x0C,0x0C,
0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0xFC,0xFC,0xFE,0xFE,0xFE,0xFE,0xFF,0x7F,0xFF,
0xFF,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x18,0x89,0x8C,0x96,0xB7,0xD5,0xD6,
0xD6,0xD6,0xDF,0xD7,0xCE,0x5C,0x18,0x18,0x08,0x00,0x00,0x00,0x00,0x40,0x7F,0xB0,
0xD8,0x6C,0x30,0x19,0x0F,0x1F,0x78,0xE0,0xC0,0xC0,0x00,0x00,0x00,0x00,0x08,0x1F,
0x0C,0x0D,0x0C,0x7F,0xC4,0x84,0x86,0x87,0x80,0xF0,0xF0,0xF0,0x00,0x00,0x00,0x00,
0x01,0x01,0x01,0x01,0x31,0x60,0xC0,0xFF,0x3F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x0F,0x7F,0xF8,0xE1,0xE1,0xC1,0xC1,0x81,0x01,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x01,0xC1,0x81,0xC1,0xE1,0xF5,0xFE,0x1F,
0x01,0x00,0x00,0xE0,0xC0,0x60,0x60,0xC0,0xC0,0x00,0x01,0xE1,0xC1,0x61,0x61,0xC1,
0xC1,0x81,0x01,0x01,0xE1,0xE0,0x60,0x60,0xC0,0x80,0x00,0x60,0xF8,0xF8,0x40,0x01,
0xC1,0xE0,0x60,0x60,0xE0,0xC0,0x00,0x01,0xFD,0xF9,0x00,0xF8,0xFC,0x80,0xC0,0xE0,
0x60,0x00,0x00,0x00,0x01,0x01,0x01,0xC1,0xC1,0x61,0x61,0x61,0xE0,0xC0,0x00,0xC0,
0xE0,0x60,0x60,0x60,0xC0,0x00,0x01,0xE1,0xE0,0x60,0x60,0xE0,0xC0,0x60,0x60,0xE0,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x03,0x0F,0x0F,0x1F,0x1F,0x1F,0x1F,0x1F,0x1F,0x03,0x07,0x03,0x03,
0x03,0x03,0x02,0x03,0x03,0x07,0x0F,0x1F,0x1F,0x1F,0x1F,0x1F,0x0F,0x07,0x00,0x00,
0x00,0x00,0x00,0xFF,0xFF,0x10,0x30,0x1F,0x0F,0x00,0x00,0xFF,0xBC,0x10,0x30,0x1F,
0x1F,0x0F,0x00,0x22,0xFF,0x18,0x10,0x10,0x1F,0x0F,0x00,0x00,0x1F,0x1F,0x10,0x08,
0x1E,0x1E,0x13,0x1B,0x1F,0x1F,0x00,0x00,0x1F,0x1F,0x00,0x1F,0x1F,0x03,0x07,0x1E,
0x18,0x00,0x00,0x18,0x18,0x00,0x04,0x0F,0x1D,0x30,0x10,0x10,0x1C,0x1C,0x00,0x0F,
0x1F,0x10,0x30,0x18,0x1F,0x07,0x00,0x1F,0x1F,0x00,0x00,0x1F,0x1F,0x00,0x00,0x1F,
};
void Oled_Show_Img(unsigned char* image)
{
unsigned char i;
unsigned int j;
for(i=0;i<8;i++)
{
Oled_Write_Cmd(0xB0+i);//page0--page7
//每个page从0列
Oled_Write_Cmd(0x00);
Oled_Write_Cmd(0x10);
//一共有128列,0~127
for(j=128*i;j<128*(i+1);j++)
{
Oled_Write_Data(image[j]);
}
}
}
void main()
{
//1、OLED初始化
Oled_Init();
//2、选择一个位置
//2.1确认页寻址模式
Oled_Write_Cmd(0x20);
Oled_Write_Cmd(0x02);
Oled_Clear();
Oled_Show_Img(bmp);
while(1);
}