中文字幕 另类精品,亚洲欧美一区二区蜜桃,日本在线精品视频免费,孩交精品乱子片免费

<sup id="3hn2b"></sup>

    1. <sub id="3hn2b"><ol id="3hn2b"></ol></sub><legend id="3hn2b"></legend>

      1. <xmp id="3hn2b"></xmp>

      2. 新聞中心

        EEPW首頁 > 嵌入式系統(tǒng) > 設(shè)計(jì)應(yīng)用 > I2C的讀寫操作實(shí)驗(yàn)

        I2C的讀寫操作實(shí)驗(yàn)

        作者: 時(shí)間:2011-05-12 來源:網(wǎng)絡(luò) 收藏

        /////////////24C08驅(qū)動程序完/////////////////////
        void Delay(unsigned int tc) //延時(shí)程序
        {
        while( tc != 0 )
        {unsigned int i;
        for(i=0; i100; i++);
        tc--;}
        }
        void LED() //LED顯示函數(shù)
        {
        shiwei=0; P0=table[sec/10]; Delay(8); shiwei=1;
        gewei=0; P0=table[sec%10]; Delay(5); gewei=1;
        }
        void t0(void) interrupt 1 using 0 //定時(shí)中斷服務(wù)函數(shù)
        {
        TH0=(65536-50000)/256; //對TH0 TL0賦值
        TL0=(65536-50000)%256; //重裝計(jì)數(shù)初值
        tcnt++; //每過250ust tcnt加一
        if(tcnt==20) //計(jì)滿20次(1秒)時(shí)
        {
        tcnt=0; //重新再計(jì)
        sec++;
        write=1; //1秒寫一次24C08
        if(sec==100) //定時(shí)100秒,在從零開始計(jì)時(shí)
        {sec=0;}
        }
        }
        void main(void)
        {
        TMOD=0x01; //定時(shí)器工作在方式1
        ET0=1; EA=1;
        x24c08_init(); //初始化24C08
        sec=x24c08_read(2);//讀出保存的數(shù)據(jù)賦于sec
        TH0=(65536-50000)/256; //對TH0 TL0賦值
        TL0=(65536-50000)%256; //使定時(shí)器0.05秒中斷一次
        TR0=1; //開始計(jì)時(shí)
        while(1)
        {
        LED();
        if(write==1) //判斷計(jì)時(shí)器是否計(jì)時(shí)一秒
        {
        write=0; //清零
        x24c08_write(2,sec); //在24c08的地址2中寫入數(shù)據(jù)sec
        }
        }
        }

        本文引用地址:http://www.antipu.com.cn/article/150752.htm

        [硬件電路圖]

        p2p機(jī)相關(guān)文章:p2p原理



        上一頁 1 2 下一頁

        關(guān)鍵詞: 實(shí)驗(yàn) 操作 讀寫 I2C

        評論


        相關(guān)推薦

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

        關(guān)閉