在线看毛片网站电影-亚洲国产欧美日韩精品一区二区三区,国产欧美乱夫不卡无乱码,国产精品欧美久久久天天影视,精品一区二区三区视频在线观看,亚洲国产精品人成乱码天天看,日韩久久久一区,91精品国产91免费

<menu id="6qfwx"><li id="6qfwx"></li></menu>
    1. <menu id="6qfwx"><dl id="6qfwx"></dl></menu>

      <label id="6qfwx"><ol id="6qfwx"></ol></label><menu id="6qfwx"></menu><object id="6qfwx"><strike id="6qfwx"><noscript id="6qfwx"></noscript></strike></object>
        1. <center id="6qfwx"><dl id="6qfwx"></dl></center>

            新聞中心

            C語言編寫的 24C02程序

            作者: 時(shí)間:2011-01-27 來源:網(wǎng)絡(luò) 收藏
            #define uchar unsigned char
            #define uint unsigned int
            #include reg52.h>
            #include stdio.h>
            #include absacc.h>
            sbit scl=P3^5; //24c02 SCL
            sbit sda=P3^4; //24c02 SDA
            sbit DOG=P1^7; //看門狗
            uchar x24c02_read(uchar address); //從24c02的地址address中讀取一個(gè)字節(jié)數(shù)據(jù)
            void x24c02_write(uchar address,uchar info); //向24c02的address地址中寫入一字節(jié)數(shù)據(jù)info
            void x24c02_init(); //24c02初始化子程序
            void delay1(uchar x);
            void flash();
            void x24c01_init();
            void start();
            void stop();
            void writex(uchar j);
            uchar readx();
            void clock();
            void delay1(uchar x)
            {
            uint i;
            for(i=0;ix;i++);
            DOG=~DOG;
            }
            void flash()
            {
            uchar u;
            DOG=~DOG;
            }
            void x24c02_init()
            {
            scl=1; flash(); sda=1; flash();
            }
            void start()
            {
            sda=1; flash(); scl=1; flash(); sda=0; flash(); scl=0; flash();
            }
            void stop()
            {
            sda=0; flash(); scl=1; flash(); sda=1; flash();
            }
            void writex(uchar j)
            {
            uchar i,temp;
            temp=j;
            for (i=0;i8;i++){
            temp=temp1; scl=0; flash(); sda=CY; flash(); scl=1; flash();
            }
            scl=0; flash(); sda=1; flash();
            }
            uchar readx()
            {
            uchar i,j,k=0;
            scl=0; flash(); sda=1;
            for (i=0;i8;i++){
            flash(); scl=1; flash();
            if (sda==1) j=1;
            else j=0;
            k=(k1)|j; scl=0;
            }
            flash(); return(k);
            }
            void clock()
            {
            uchar i=0;
            scl=1; flash();
            while ((sda==1)(i255))i++;
            scl=0; flash();
            }
            uchar x24c02_read(uchar address)
            {
            uchar i;
            start(); writex(0xa0);
            clock(); writex(address);
            clock(); start();
            writex(0xa1); clock();
            i=readx(); stop();
            delay1(10);
            return(i);
            }
            void x24c02_write(uchar address,uchar info)
            {
            EA=0;
            start(); writex(0xa0);
            clock(); writex(address);
            clock(); writex(info);
            clock(); stop();
            EA=1;
            delay1(50);
            }
            燃?xì)鈭?bào)警器相關(guān)文章:燃?xì)鈭?bào)警器原理


            評(píng)論


            相關(guān)推薦

            技術(shù)專區(qū)

            關(guān)閉