当前位置: 首页 > article >正文

单片机C51--笔记8-STC89C51RC/RD-IIC协议

一、概述

        IIC全称Inter-Integrated Circuit (集成电路总线) 是由PHILIPS公司在80年代开发的两线式串行总线,用于连接微控制器及其外围设备。IIC属于半双 工同步通信方式。

特点

简单性和有效性。

        由于接口直接在组件之上,因此IIC总线占用的空间非常小,减少了电路板的空间和芯片管脚的数量,降 低了互联成本。总线的长度可高达25英尺,并且能够以10Kbps的最大传输速率支持40个组件

        多主控(multimastering) 其中任何能够进行发送和接收的设备都可以成为主总线。一个主控能够控制信号的传输和时钟频率。当 然,在任何时间点上只能有一个主控。

        构成 IIC串行总线一般有两根信号线,一根是双向的数据线SDA,另一根是时钟线SCL,其时钟信号是由主控 器件产生。所有接到IIC总线设备上的串行数据SDA都接到总线的SDA上,各设备的时钟线SCL接到总线 的SCL上。对于并联在一条总线上的每个IC都有唯一的地址。

 二、IIC协议三种信号

IIC总线在传输数据的过程中一共有三种类型信号,分别为:开始信号、结束信号和应答信号。

我们关注虚线部位

  • 起始信号S:

scl = 1;

sda = 1;

延时大于4.7微妙    //这里用一个_nop_();函数就够了,一个_nop_();函数就相当于5微妙

sda = 0;

延时大于4微妙

  •  终止信号P:

scl = 1;

sda = 0;

延时大于4微妙

sda = 1;

延时大于4.7微妙

  • 应答信号“0”/”1“

        发送器每发送一个字节(8个bit),就在时钟脉冲9期间释放数据线,由接收器反馈一个应答信号。

        应答信号为低电平时,规定为有效应答位(ACK,简称应答位),表示接收器已经成功地接收了该字 节;

         应答信号为高电平时,规定为非应答位(NACK),一般表示接收器接收该字节没有成功。

char flag;//在应答函数中定义一个临时变量flag,用于接收sda的值,返回flag。后面判断flag的值是1/0就知道应答信号有没有接收成功(板子不同说明不同,具体看说明书)

sda = 1;//在时钟脉冲9期间释放数据线

_nop_();

scl = 1;

_nop_();

flag = sda;//判断这时候的sda的值是1还是0,是0就代表有效应答位,是1就代表非应答位

_nop_();

scl = 0;

_nop_();

return flag;

  • 数据发送的时序图

SDA只在SCL是低电平期间发生翻转  在SCL高电平期间SDA发生数据的翻转是在发送起始和终止信号,和传输数据的过程

 现在假设传进来的数据是dataSend = 0100 1100

scl = 0;//在这个期间发生数据的翻转

sda = dataSend & 0x80;  //与上1000 0000获得dataSend的最高位,给sda

_nop_();  //延时一段时间  //发送数据建立的时间

scl = 1;  //在这个期间开始发送数据

延时一段时间  //数据发送的时间

scl = 0;  //发送完毕 手动拉低

延时一段时间

dataSend  = dataSend << 1;//向左移一位  //接着向下传递

让下一位变成第一位,也就是让其&上1000 0000就好

 三、OLED写命令

注意:

Co-Continuation bit(Co - 持续字节)

D/C# – Data / Command Selection bit (数据/命令选择位)

ACK – Acknowledgement (确认)

SA0 – Slave address bit (从设备地址字节)

R/W# – Read / Write Selection bit (读/写选择位)

S – Start Condition / P – Stop Condition (S-开始状态,P-结束状态)

1. start()

2. 写入 b0111 1000 0x78

3. ACK

4. cotrol byte: (0)(0)000000 写入命令   (0)(1)000000写入数据

5. ACK

6. 写入指令/数据

7. ACK

8. STOP

// 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();

 四、OLED的寻址模式

  • 三种寻址模式方式

1、页地址寻址模式

        在这种模式下,屏幕被分为8个页面,每个页面包含8行像素。通过设置页面地址和行地址,可以定位到具体的页面和行,然后写入数据。页寻址模式的优点是操作简单,适合大多数应用场景。

寻址流程:

在此模式下,GDDRAM(图形显示数据RAM)的访问是按页进行的。

每次写入数据后,列地址指针会自动增加1。若到达该页的终止列地址,列地址指针会复位到该页的起始列,而页地址指针不改变。

要访问下一页的内容,需手动设置新的页地址和列地址。

通常用于小区域数据的修改‌

假设从PAGE0的COL0开始寻址,一直寻址到COL127,到COL127后,如果没有手动更改页,那么就会依旧从PAGE0页的COL0开始寻址,改页需要手动更改,再第二页的COL0开始寻址,一页一页的寻址。

2、水平地址寻址模式

        水平寻址模式通过设置页面地址和列地址来定位屏幕上的具体位置。在这种模式下,屏幕被分为多个水平列,通过设置列地址来定位具体的列,然后写入数据。水平寻址模式适用于需要精细控制屏幕特定区域的应用场景。、

在此模式下,每次数据访问后,列地址指针会自动增加1。

若列地址指针到达列终止地址,列地址指针会复位到列起始地址,并且页地址指针也会自动增加1。

此模式适用于连续更新整个屏幕或按行更新数据‌

寻址流程:假设从PAGE0的COL0开始寻址,一直寻址到COL127,到COL127之后,会自动变成从PAGE1的COL0开始寻址,这是连续的

3、垂直地址寻址模式(使用少)

        垂直寻址模式通过设置行地址和列地址来定位屏幕上的具体位置。在这种模式下,屏幕被分为多个垂直列,通过设置行地址来定位具体的行,然后写入数据。垂直寻址模式适用于需要精细控制屏幕特定区域的应用场景,但相对于水平寻址模式,其使用较少。

在此模式下,每次数据访问后,页地址指针会自动增加1。

若页地址指针到达页终止地址,页地址指针会复位到页起始地址,并且列地址指针也会自动增加1。

此模式在需要按列更新数据时使用‌

一个字节负责一个PAGE的一列显示

假设,PAGE0的0x10就是下面图的样子。会再屏幕中只显示一个点

 

 确认寻址方式

例如选择页寻址方式

发送一个 Cmd  0X20;

发送一个 Cmd  0X02;

  •  页地址的改变

五、OLED 的使用

  • 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 
}
  • 显示一个点

在主函数中,使用OLED显示一个点的流程如下

1、OLED初始化

2、选择一个位置

        2.1、确认页寻址模式

        2.2、选择PAGE0

3、显示一个点

主函数的代码如下:

        //1. OLED初始化
		Oled_Init();
		//2. 选择一个位置
		//2.1 确认页寻址模式
		Oled_Write_Cmd(0x20);
		Oled_Write_Cmd(0x02);
		//2.2 选择PAGE0   1011 0000
		//					0xB0
		Oled_Write_Cmd(0xB0);
	  //3. 显示一个点
		Oled_Write_Data(0x08);
  • 显示一行点

	//1.初始化oled
	Oled_Init();
	//2.选择一个位置
	//2.1 确认是页寻址模式
	Oled_Write_Data(0x20);
	Oled_Write_Data(0x02);
	Oled_Clear();
	//2.2 选择PAGE0 1011 0000
	Oled_Write_Cmd(0xB0);
	//3显示一个点
	Oled_Write_Data(0x08);
	Oled_Write_Data(0x08);
	Oled_Write_Data(0x08);
	Oled_Write_Data(0x08);
	Oled_Write_Data(0x08);
  • 显示一个字母A

先使用点阵液晶取模

设置参数为

将生成的点阵赋值

可以看到A的点阵宽8*高16,宽8<128 可以使用

高16 >8 所以一个PAGE不够,要用到两个

代码如下:

/*--  文字:  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_Data(0x20);
	Oled_Write_Data(0x02);
	Oled_Clear();
	//2.2 选择PAGE0 1011 0000
	Oled_Write_Cmd(0xB0);
	Oled_Write_Cmd(0x00);
	Oled_Write_Cmd(0x10);
	for(i=0;i<8;i++){//显示一个A
		Oled_Write_Data(A1[i]);
	}
	Oled_Write_Cmd(0xB1);
	Oled_Write_Cmd(0x00);
	Oled_Write_Cmd(0x10);
	for(i=0;i<8;i++){//显示一个A
		Oled_Write_Data(A2[i]);
	}
	while(1);
 } 
  • 显示一行字

 代码如下:

/*--  文字:  一  --*/
/*--  宋体12;  此字体下对应的点阵为:宽x高=16x16   --*/
code char Y1[16] = {0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x00};
code char Y2[16] = {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};

/*--  文字:  行  --*/
/*--  宋体12;  此字体下对应的点阵为:宽x高=16x16   --*/
code char X1[16] = {0x00,0x10,0x88,0xC4,0x33,0x00,0x40,0x42,0x42,0x42,0xC2,0x42,0x42,0x42,0x40,0x00};
code char X2[16] = {0x02,0x01,0x00,0xFF,0x00,0x00,0x00,0x00,0x40,0x80,0x7F,0x00,0x00,0x00,0x00,0x00};

/*--  文字:  字  --*/
/*--  宋体12;  此字体下对应的点阵为:宽x高=16x16   --*/
code char Z1[16] = {0x10,0x0C,0x04,0x24,0x24,0x24,0x25,0x26,0xA4,0x64,0x24,0x04,0x04,0x14,0x0C,0x00}
code char Z2[16] = {0x02,0x02,0x02,0x02,0x02,0x42,0x82,0x7F,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x00}
void main()
{
	int i; 
	//1.初始化oled
	Oled_Init();
	//2.选择一个位置
	//2.1 确认是页寻址模式
	Oled_Write_Data(0x20);
	Oled_Write_Data(0x02);
	Oled_Clear();
	//2.2 选择PAGE0 1011 0000
	Oled_Write_Cmd(0xB0);
	Oled_Write_Cmd(0x00);
	Oled_Write_Cmd(0x10);
	for(i=0;i<16;i++){
		Oled_Write_Data(Y1[i]);
	}
    for(i=0;i<16;i++){
		Oled_Write_Data(H1[i]);
	}
    for(i=0;i<16;i++){
		Oled_Write_Data(Z1[i]);
	}
	Oled_Write_Cmd(0xB1);
	Oled_Write_Cmd(0x00);
	Oled_Write_Cmd(0x10);
	for(i=0;i<16;i++){
		Oled_Write_Data(Y2[i]);
	}
    for(i=0;i<16;i++){
		Oled_Write_Data(H2[i]);
	}
    for(i=0;i<16;i++){
		Oled_Write_Data(Z2[i]);
	}
	while(1);
 } 

  • 显示一张图片

 代码如下:

code unsigned char bmgImager[] = {
	/*--  调入了一幅图像:D:\yingyong\qian_ru_shi\Keil\code\17-IIC协议\图片.bmp  --*/
/*--  宽度x高度=128x64  128*8(PAGE 有八个字节)*8(PAGE)=--*/
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,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0xFE,0x80,0x80,0x80,
0x80,0xFF,0xFF,0xFF,0x00,0x00,0x08,0x1C,0x1C,0x1C,0x1C,0xFC,0xFC,0xFC,0x1C,0x1C,
0x18,0x00,0x00,0x04,0x1E,0xFE,0xFC,0xF0,0x80,0xE0,0xF0,0xFC,0x7E,0x1C,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,0x80,0xC0,
0xE0,0xE0,0xF0,0xF0,0x70,0x78,0x78,0x38,0x38,0x38,0x38,0x38,0x38,0x78,0xF0,0xE0,
0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x80,0xC0,0xE0,0xF0,0xF8,0x78,0x38,0x1C,0x1C,0x1C,0x1C,0x1C,
0x1C,0x3C,0x38,0x78,0x70,0xF0,0xE0,0xC0,0x00,0x00,0xFF,0xFF,0xFF,0x07,0x07,0x07,
0x07,0xFF,0xFF,0xFF,0x00,0xF0,0xF8,0xF0,0xE0,0xE0,0xE0,0xFF,0xFF,0xFF,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x01,0x03,0xFF,0xFF,0xFF,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,0x00,0x00,0xFE,0xFF,0xFF,
0x01,0x01,0x00,0x00,0xF0,0xF8,0xF8,0x38,0x38,0x78,0xF8,0xF0,0xC0,0x00,0x01,0x07,
0xFF,0xFF,0xFC,0xE0,0xE0,0xE0,0xE0,0xE0,0xE0,0xE0,0xE0,0xE0,0xE0,0xE0,0xE0,0xE0,
0xE0,0xE0,0xF0,0xFE,0xFF,0x3F,0x07,0x01,0x00,0x00,0xE0,0xF8,0x7C,0x3E,0x1E,0xFE,
0xFC,0xF8,0x80,0x00,0x00,0xE1,0xFF,0xFF,0x7F,0x00,0x00,0x01,0x01,0x00,0x00,0x00,
0x00,0x00,0x01,0x01,0x00,0x00,0x00,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF,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,0x80,0x80,0xC0,0xE0,0xE0,0xE0,0xF0,0x73,0x7F,0x1F,
0x00,0x00,0x00,0x00,0x07,0x0F,0x0F,0x00,0x00,0x00,0x03,0x07,0x07,0x00,0x00,0x00,
0x01,0x03,0x03,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x01,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x07,0x07,0x00,0x00,0x00,0x00,
0x03,0x07,0x07,0x00,0x00,0x03,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x0F,0x0E,0x3E,
0xF8,0xF0,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0x0F,0x07,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0xC0,0xF0,0xFC,0x7E,0x3F,0x0F,0x07,0x03,0x03,0x01,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF0,0xFC,0xFE,0xBF,0x8F,0xC7,0xC7,
0x8F,0x9E,0xBC,0xF8,0xF0,0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x80,0xE0,0xF0,0xF8,0x3C,0x3C,0x1C,0x3C,0xF8,0xF8,0xE0,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x03,0x1F,0x7F,0xFE,0xF0,0xC0,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,0xFC,
0xFF,0xFF,0x07,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xC0,0xC0,0x80,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0x7F,0x7F,0x7F,0x7F,0xFF,0xFF,
0xFF,0xFF,0x7F,0x3F,0x1F,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x1F,0x1F,0x3F,0x7E,0xFF,0xFF,0xFE,0xFE,0xFF,0x3F,0x03,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0xE0,0xE0,0xE0,0xC0,0xC0,0x80,
0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFC,0xFE,
0xFE,0x2E,0x1E,0x1C,0x3C,0x78,0x78,0x7C,0x7E,0x3E,0x1E,0x0F,0x8F,0xFE,0xFC,0xF8,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,
0xFF,0xFF,0xC0,0x00,0x00,0x00,0x00,0x06,0x0F,0x0F,0x07,0x13,0x3B,0x3D,0x3C,0xDF,
0xEF,0xF0,0x78,0x7C,0x38,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x20,0xF0,0xF0,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0xC0,0xE0,0xF0,0xE0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xC8,0xDC,0xDC,0xDD,0xBD,0xBB,0x33,
0x00,0x00,0xC0,0xFC,0xFF,0x7F,0x07,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x03,
0x07,0x0F,0x0E,0x1E,0x1C,0x3C,0x38,0x38,0x38,0x1C,0x1C,0x1E,0x0F,0x0F,0x07,0x01,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x01,0x03,0x07,0x07,0x0F,0x1E,0x1C,0x3C,0x38,0x78,0x70,0x70,0x70,0xF0,0xE0,0xE0,
0xE1,0xE0,0xC0,0xC0,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x03,0x07,0x0E,0x0C,0x0C,0x1C,0x1C,0x1C,0x1C,0x1E,0x1E,0x0F,
0x07,0x07,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x81,0xC3,0xC3,0xC7,0xE7,
0xFE,0x7E,0x3F,0x0F,0x03,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
};

void Oled_Show_Image(unsigned char *image)
{
	unsigned char i;
	unsigned int j;
	
	for(i=0;i<8;i++){//8行
		Oled_Write_Cmd(0xB0+i);//page0-page7
		//每个page从0列到127列,依次写入0,每写入数据,列地址自动偏移
		Oled_Write_Cmd(0x00); 
		Oled_Write_Cmd(0x10);
		for(j=128*i;j<(128*(i+1));j++){//j是从八行中每一行的起始位置开始计算的,j<每一行的最后一位
			Oled_Write_Data(image[j]);
		}	
	}
}


void main()
{
	//1.初始化oled
	Oled_Init();
	//2.选择一个位置
	//2.1 确认是页寻址模式
	Oled_Write_Data(0x20);
	Oled_Write_Data(0x02);
	Oled_Clear();
	Oled_Show_Image(bmgImager);
	while(1);
	
 } 


http://www.kler.cn/a/429838.html

相关文章:

  • 太速科技-614-基于6U VPX FPGA VU9P 4路100G、32路10Gbps的光纤卡
  • 力扣第95题 不同的二叉搜索树 II
  • 【WebRTC】Android SDK使用教学
  • 如何使用靜態IP代理?【詳細教程】
  • 云原生周刊:在Docker上部署大语言模型
  • scala 身份证号码
  • hping3-网络工具
  • Brain.js(六):构建FNN神经网络实战教程 - 用户喜好预测
  • 鸿蒙实现后台任务管理
  • 「Mac畅玩鸿蒙与硬件44」UI互动应用篇21 - 随机励志语录生成器
  • Springboot3整合Redis
  • Fyne ( go跨平台GUI )中文文档-Fyne总览(二)
  • gitlab配置调试minio
  • Java将数组转换成字符串
  • 构建万能 MOCK-API
  • 如何在拉丁美洲推广游戏
  • docker逃逸总结
  • vue+elementUI+transition实现鼠标滑过div展开内容,鼠标划出收起内容,加防抖功能
  • docker搭建elasticsearch服务
  • python爬虫--小白篇【爬虫实践】