- 1、本文档共27页,可阅读全部内容。
- 2、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
- 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
24c02可随机读写(24C02 can be read and write randomly)
24c02可随机读写(24C02 can be read and write randomly)
The following / / main.c file
/****************************************************************************************
* Description: 24C02 chip IIC experiment, SDA, SCL receive P27/P10 pin, hardware address pin A0/A1/A2 ground, write protect WP ground
****************************************************************************************/
#include reg52.h
#include I2C.h
#define uchar unsigned char
#define uint unsigned int
Sbit P11 = P1^1;
//-----------------------------------------------------
(main)
{
Uchar, code, shu[12]={0xc0,0xf9,0xa4,0xb0,0x99, //0,1,2,3,4,
0x92,0x82,0xf8,0x80,0x90, //5,6,7,8,9,
0x00,0xff}; / / destroy common anode digital tube display code
Uchar i;
Uchar s[4];
I2C_Init ();
Delay (60000);
I2CRandomGets (0xa0,0,1, s);
S[0]++;
Delay (1000);
I2C_Puts (0xa0,0,1, s);
S[1]=s[0]/100;
S[2]=s[0]%100/10;
S[3]=s[0]%10;
While (1)
{
For (i=0; i3; i++)
{P0=0Xff;
P2= (~ (0X01i));
P0=shu[s[i+1]];
Delay (100);
}
}
}
//main ()
//{
Uchar 0xf9,0xa4,0xb0,0x99, 0x92,0x82,0xf8,0x80,0x96,0x00,0xff} / shu[12]={0xff;
/ /
Uchar / / s[12];
(/ / I2C_Init);
/ / delay (60000);
/ / I2CRandomPuts (0xa0,20,12, Shu);
/ / delay (1000);
/ / I2CRandomGets (0xa0,20,12, s);
/ / while (1)
{/ /
/ / while ((s[0] = = shu[0]) (s[9] = = shu[9]))
{/ /
/ / delay (65530);
/ / P11 = P11; //LED lights flash!
} / /
} / /
//}
The following / / I2C.C file
#include I2C.H
Void delay (unsigned int t) / / delay function
{
For ((T; =0; t--);
}
/******************************************************************************
Function: I2C_Delay ()
Function: analog I2C bus delay
Description: please adjust the delay value according to specific conditions
******************************************************************************/
Void, I2C_Delay ()
{
Unsigned char t;
T = 10;
While (--t! = 0); / / 2*t delay machine cycles
}
/******************************************************************************
Function: I2C_Init ()
Function: I2C bus initializ
您可能关注的文档
- 2011beta3图标位子 ---------------免费刷钻+ 1107587399(2011beta3 icon - free brush drill + seat 1107587399).doc
- 2010级沈阳工程学院学士学位授予工作细则_沈阳工程学院(2010 Shenyang Institute of Engineering bachelor's degree from Shenyang Institute of Engineering _ work rules).doc
- 2010财管教材勘误(2010, financial management, teaching materials, correction).doc
- 2011届钻石卡学员考研全程总规划(The 2011 diamond card student postgraduate entrance examination master plan).doc
- 2011届高考数学单元练习及解析简单的逻辑联结词、全称量词与存在量词(Exercises and analysis of the 2011 college entrance examination mathematics unit simple logical connectives, full name quantifiers and existential quantifiers).doc
- 2011年(重庆卷)文言文阅读(2011 (Chongqing volume) classical Chinese Reading).doc
- 2011年4月自学考试护理学导论试题(Introduction to nursing examination in April 2011).doc
- 2011年4月自考真题机械设计基础(From April 2011 Zhenti mechanical design foundation).doc
- 2011届黄冈中学高考复习教案(内部)——第三课时 线性规划.._百度文库...(The 2011 session of the Huanggang middle school entrance exam teaching plan (internal) - third class linear programming.._ Baidu library...).doc
- 2011年七年级语文暑假作业5 字音(无答案)苏教版(In 2011 seven grade Chinese homework 5 pronunciation (no answer) Jiangsu).doc
最近下载
- 精品解析:2024年山东省中考语文试题(解析版).docx
- 大学教师的职业生涯规划省公开课一等奖全国示范课微课金奖PPT课件.pptx VIP
- 2023年南京铁道职业技术学院招聘考试真题(含答案).pdf VIP
- DG╱TJ 08-67-2015 园林绿化草坪建植和养护技术规程.pdf
- 2024年中国东航所属东航技术应用研发中心限公司校园招聘【综合基础知识500题】高频考点模拟试题及参考答案解析.docx
- 外国专家项目远程教学服务合同.docx VIP
- 乡镇卫生院绩效考核表格.docx
- 配电房+消防水池工程量清单报价.xls VIP
- 电子图书目录.xlsx VIP
- 过氧化氢法生产环氧丙烷安全设计.docx
文档评论(0)