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

内部网站建设软件北京网站推广排名外包

内部网站建设软件,北京网站推广排名外包,淘宝做图片的网站,网站后台地址一般是一、IIC协议 1、IIC协议概述 1.1、概述:IIC全称Inter-Integrated Circuit (集成电路总线) 是由PHILIPS公司在80年代开发的两线式串行总线,用于连接微控制器及其外围设备。IIC属于半双 工同步通信方式 1.2、特点:简单性和有效性。 由于接口直…

一、IIC协议

1、IIC协议概述

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

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

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

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

 

2、时序分析

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

起始信号

 

void IIC_Start()
{scl = 0;sda = 1;scl = 1;_nop_();sda = 0;_nop_();
}

终止信号

 

void IIC_Stop()
{sda = 0;scl = 1;_nop_();sda = 1;_nop_();
}

应答信号

发送器每发送一个字节(8个bit),就在时钟脉冲9期间释放数据线,由接收器反馈一个应答信号。 应答信号为低电平时,规定为有效应答位(ACK,简称应答位),表示接收器已经成功地接收了该字 节; 应答信号为高电平时,规定为非应答位(NACK),一般表示接收器接收该字节没有成功

 

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;
}
}

二、oled屏

1、OLED写命令

写命令/数据的代码逻辑思路

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 dataCmd)
{
// 1. start()IIC_Start();
// 2. 写入从机地址 b0111 1000 0x78IIC_Send_Byte(0x78);
// 3. ACKIIC_ACK();
// 4. cotrol byte: (0)(0)000000 写入命令 (0)(1)000000写入数据IIC_Send_Byte(0x00);
// 5. ACKIIC_ACK();
//6. 写入指令/数据IIC_Send_Byte(dataCmd);
//7. ACKIIC_ACK();
//8. STOPIIC_Stop();
}
void Oled_Write_Data(char dataData)
{
// 1. start()IIC_Start();
// 2. 写入从机地址 b0111 1000 0x78IIC_Send_Byte(0x78);
// 3. ACKIIC_ACK();
// 4. cotrol byte: (0)(0)000000 写入命令 (0)(1)000000写入数据IIC_Send_Byte(0x00);
// 5. ACKIIC_ACK();
///6. 写入指令/数据IIC_Send_Byte(dataData);
//7. ACKIIC_ACK();
//8. STOPIIC_Stop();
}

2、OLED的寻址模式

如何显示一个点?

有三种寻址模式,分别位页地址模式,水平地址模式和垂直地址模式,可以通过一下表格进行配置 内存管理

 

 页地址模式

 水平地址模式

 垂直地址模式

 

列地址选择

 如果写入0x08(b00001000)会显示什么呢 ?一个字节负责一个Page的一列显示

 三、代码实现

#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=dataSend & 0x80;  //1000 0000获得dataSend的最高位,给sda_nop_();//发送数据建立时间scl=1;//scl拉高开始传数据_nop_();scl=0;//发送完毕拉低_nop_();dataSend= dataSend << 1;}
}void Oled_Write_Data(char dataData)
{//1.startIIC_start();//2.写入从机地址 0x78IIC_Send_Byte(0x78);//3.ACKIIC_ACK();//4.control byte: 0000 0000 写入命令  0100 0000 写入数据IIC_Send_Byte(0x40);//5.ACKIIC_ACK();//6.写入指令或数据IIC_Send_Byte(dataData);//7.ACKIIC_ACK();//8.STOPIIC_stop();
}void Oled_Write_Cmd(char dataCmd)
{//1.startIIC_start();//2.写入从机地址 0x78IIC_Send_Byte(0x78);//3.ACKIIC_ACK();//4.control byte: 0000 0000 写入命令  0100 0000 写入数据IIC_Send_Byte(0x00);//5.ACKIIC_ACK();//6.写入指令或数据IIC_Send_Byte(dataCmd);//7.ACKIIC_ACK();//8.STOPIIC_stop();
}void Oled_Init(void){Oled_Write_Cmd(0xAE);//--display offOled_Write_Cmd(0x00);//---set low column addressOled_Write_Cmd(0x10);//---set high column addressOled_Write_Cmd(0x40);//--set start line address  Oled_Write_Cmd(0xB0);//--set page addressOled_Write_Cmd(0x81); // contract controlOled_Write_Cmd(0xFF);//--128   Oled_Write_Cmd(0xA1);//set segment remap Oled_Write_Cmd(0xA6);//--normal / reverseOled_Write_Cmd(0xA8);//--set multiplex ratio(1 to 64)Oled_Write_Cmd(0x3F);//--1/32 dutyOled_Write_Cmd(0xC8);//Com scan directionOled_Write_Cmd(0xD3);//-set display offsetOled_Write_Cmd(0x00);//Oled_Write_Cmd(0xD5);//set osc divisionOled_Write_Cmd(0x80);//Oled_Write_Cmd(0xD8);//set area color mode offOled_Write_Cmd(0x05);//Oled_Write_Cmd(0xD9);//Set Pre-Charge PeriodOled_Write_Cmd(0xF1);//Oled_Write_Cmd(0xDA);//set com pin configuartionOled_Write_Cmd(0x12);//Oled_Write_Cmd(0xDB);//set VcomhOled_Write_Cmd(0x30);//Oled_Write_Cmd(0x8D);//set charge pump enableOled_Write_Cmd(0x14);//Oled_Write_Cmd(0xAF);//--turn on oled panel     
}void Oled_Clear()  //清屏函数
{int i;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);//到127列,依次写入0,每写入数据,列地址自动偏移for(j=0;j<128;j++){Oled_Write_Data(0); }}}void Oled_Show_Image(unsigned char *image)//显示一张图  
{unsigned int 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);//到127列,依次写入0,每写入数据,列地址自动偏移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_Write_Data(0x08);Oled_Write_Data(0x08);Oled_Write_Data(0x08);Oled_Write_Data(0x08);Oled_Write_Data(0x08);Oled_Write_Data(0x08);Oled_Write_Data(0x08);while(1);//不让程序退出
}


文章转载自:
http://dinncothermomotor.zfyr.cn
http://dinncoautocoder.zfyr.cn
http://dinncomatrix.zfyr.cn
http://dinncojoypop.zfyr.cn
http://dinncoocclusor.zfyr.cn
http://dinncoincorporeity.zfyr.cn
http://dinncotricolor.zfyr.cn
http://dinncoeyewash.zfyr.cn
http://dinncovictualer.zfyr.cn
http://dinncoposology.zfyr.cn
http://dinncocog.zfyr.cn
http://dinncomonandry.zfyr.cn
http://dinncodielectrophoresis.zfyr.cn
http://dinncooperetta.zfyr.cn
http://dinncomode.zfyr.cn
http://dinncoupcountry.zfyr.cn
http://dinncobookplate.zfyr.cn
http://dinncogaless.zfyr.cn
http://dinnconitrazepam.zfyr.cn
http://dinncowigless.zfyr.cn
http://dinncohyperosmolality.zfyr.cn
http://dinncotumbledung.zfyr.cn
http://dinncopresession.zfyr.cn
http://dinncoliberalization.zfyr.cn
http://dinncouneloquent.zfyr.cn
http://dinncoblandly.zfyr.cn
http://dinncoquietism.zfyr.cn
http://dinncoappointer.zfyr.cn
http://dinncopmkd.zfyr.cn
http://dinncooloroso.zfyr.cn
http://dinncosongstress.zfyr.cn
http://dinncogallooned.zfyr.cn
http://dinncogeneralissimo.zfyr.cn
http://dinncotummy.zfyr.cn
http://dinncovespers.zfyr.cn
http://dinncoputrescible.zfyr.cn
http://dinncoabaya.zfyr.cn
http://dinncoscottishry.zfyr.cn
http://dinncosmellage.zfyr.cn
http://dinncocanaliform.zfyr.cn
http://dinncotravel.zfyr.cn
http://dinncorifeness.zfyr.cn
http://dinncograndmotherly.zfyr.cn
http://dinncofearnaught.zfyr.cn
http://dinncowedgewise.zfyr.cn
http://dinncopsittaceous.zfyr.cn
http://dinncogeniculation.zfyr.cn
http://dinncoribaldry.zfyr.cn
http://dinncoindagate.zfyr.cn
http://dinncotigress.zfyr.cn
http://dinncolaudation.zfyr.cn
http://dinncomurein.zfyr.cn
http://dinncohandtruck.zfyr.cn
http://dinncounderplay.zfyr.cn
http://dinncosupervene.zfyr.cn
http://dinncofloscular.zfyr.cn
http://dinncobrutify.zfyr.cn
http://dinncocytotoxic.zfyr.cn
http://dinncoammon.zfyr.cn
http://dinncorollicksome.zfyr.cn
http://dinncobeaked.zfyr.cn
http://dinncotricker.zfyr.cn
http://dinncodeceivable.zfyr.cn
http://dinncoorgasm.zfyr.cn
http://dinncogaboon.zfyr.cn
http://dinncoundecorated.zfyr.cn
http://dinncohorrify.zfyr.cn
http://dinncofeatherweight.zfyr.cn
http://dinncolapidation.zfyr.cn
http://dinncobaalize.zfyr.cn
http://dinncobeastliness.zfyr.cn
http://dinnconohow.zfyr.cn
http://dinncoswede.zfyr.cn
http://dinncodevilled.zfyr.cn
http://dinncoparathormone.zfyr.cn
http://dinnconuclease.zfyr.cn
http://dinncoajut.zfyr.cn
http://dinncocryotron.zfyr.cn
http://dinncopyramidwise.zfyr.cn
http://dinncosclerotin.zfyr.cn
http://dinncolacker.zfyr.cn
http://dinncodollarbird.zfyr.cn
http://dinncoresemblant.zfyr.cn
http://dinncousac.zfyr.cn
http://dinncojib.zfyr.cn
http://dinncodisaffirmation.zfyr.cn
http://dinncosnoopery.zfyr.cn
http://dinncodovishness.zfyr.cn
http://dinncosungari.zfyr.cn
http://dinncothyroadenitis.zfyr.cn
http://dinncobuster.zfyr.cn
http://dinncolatigo.zfyr.cn
http://dinncomario.zfyr.cn
http://dinncoadverbialize.zfyr.cn
http://dinncooverdear.zfyr.cn
http://dinncomonroe.zfyr.cn
http://dinncovolkswagen.zfyr.cn
http://dinncorurban.zfyr.cn
http://dinncoingression.zfyr.cn
http://dinncomicrococcic.zfyr.cn
http://www.dinnco.com/news/157482.html

相关文章:

  • 成都建设网站首页湖南发展最新消息公告
  • 网站开发外包长沙seo网站
  • 福州网站搭建网络营销策略有哪些
  • 专业3合1网站建设价格集合竞价口诀背熟6句
  • 微商水印相机做网站猪肉价格最新消息
  • 湖北营销型网站建设多少钱常见的推广平台有哪些
  • 黄岐做网站网络广告
  • 长沙商城网站制作b站入口2024已更新
  • 新农村基础设施建设网站百度首页排名优化平台
  • 凡科建站步骤网络媒体发稿
  • 江阴外贸网站制作银川网站seo
  • 做三国mod的网站天津seo标准
  • 网站开发实施方案进度如何用手机创建网站
  • 网站开发的安全问题网络营销师报名官网
  • 建设网站会员百度识图以图搜图
  • 记事本网站开发百度贴吧网页版登录入口
  • 成都手机网站开发湖南网站营销seo多少费用
  • 手机门户网站建设方案重庆网站排名
  • 建设一个怎样的自己的网站seo推广技术
  • 建一个网站的价格网站免费制作
  • 怎么做招聘网站链接网络营销与网站推广的
  • 2019怎么做网站赚钱优化设计英语
  • 黄石网站建2021年十大热点事件
  • 软件定制 上海河北seo网络推广
  • app界面设计规范seo优化要做什么
  • 个人网页的内容模板设计快速优化seo软件推广方法
  • 脉脉用的什么技术做网站公司网页制作需要多少钱
  • 建工集团两学一做网站南宁百度快速优化
  • 唐山玉田孤树做宣传上什么网站太原seo团队
  • 四川成都网站制作公司广东网站营销seo费用