欢迎来到天天文库
浏览记录
ID:12732198
大小:21.79 KB
页数:23页
时间:2018-07-18
《 ic键盘显示c程序( ic keyboard display c program)》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、7290i2c键盘显示c51程序(7290I2CkeyboarddisplayC51program)7290I2CkeyboarddisplayC51program[2005-8-1710:18:53Kassey]By:
2、/*****************************************File:iic.hDescription:issuitablefor24MHzcrystaloscillator,referringtowww.zlgmcu.comprogramAuthor:kassey@126.comDate:July,7
3、th,2005*****************************************/Include/**/*containsheaderfilesInclude#define(_Nop)_nop_()/*definitionofaninstruction./*often,variabledefinitionregion*/Adefinitionofport/**/SbitSDA=P1^0;/*I2C*/bitdatatransfersimulationSbitSCL=P1^1;/**/I2C
4、analogclockcontrolSign/**/Bitack;/**/responseflag/*******************************************************************StartingbusfunctionPrototypeoffunction:voidStart_I2c();Function:starttheI2Cbus,thatis,sendtheI2Cstartcondition************************************************
5、********************/VoidStart_I2c(){SDA=1;datasignalsending*//*initialcondition_Nop();_Nop();SCL=1;(_Nop);/*initialconditionsfortheestablishmentoftimeisgreaterthan4.7us,delay._Nop();_Nop();_Nop();_Nop();(_Nop);/*initialconditionsfortheestablishmentoftimeisgreaterthan4.7us,d
6、elay._Nop();_Nop();_Nop();_Nop();SDA=0;/**/sendstartsignal(_Nop);/*initialconditionofthelockingtimeofmorethan4mus*/_Nop();_Nop();_Nop();_Nop();(_Nop);/*initialconditionsfortheestablishmentoftimeisgreaterthan4.7us,delay._Nop();_Nop();_Nop();_Nop();SCL=0;/*I2Cgrabbedthebus,rea
7、dytosendorreceivedata._Nop();_Nop();_Nop();_Nop();}/*******************************************************************EndbusfunctionPrototypeoffunction:voidStop_I2c();Function:endtheI2Cbus,thatis,sendtheI2Cendcondition********************************************************
8、************/VoidStop_I2c(){SDA=0;datasignalssentovertheconditions*//*(_Nop)clocksignal;/*sendendconditions(_Nop)clocksignal;/*sendendconditionsSCL=1;/*endtimeconditionsfortheestablishmentofmorethan4mus*/_Nop();_Nop();_Nop();_Nop();_Nop();_Nop();_Nop();_Nop();_Nop();_Nop();S
9、DA=1;/**/I2Cbussendendsignal_Nop();_Nop();_Nop();_Nop();_Nop();_Nop();_Nop(
此文档下载收益归作者所有