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

<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è)計應用 > PCF8583+LM1602的protues仿真實例(C語言)

        PCF8583+LM1602的protues仿真實例(C語言)

        作者: 時間:2016-11-25 來源:網(wǎng)絡 收藏
        程序代碼:

        #include
        #include
        #include
        #define lcdwritecmd XBYTE[0xFC00]
        #define ledwritedat XBYTE[0xFE00]
        sbit SCL=P1^0 ;
        sbit SDA=P1^1 ;
        char tab[2];
        unsigned char year,mon,day,hour,min,sec,state,hudsec;
        //============================延時函數(shù)====================================
        void delay(unsigned char n)
        {
        unsigned char i,j;
        for(i=0;i for(j=0;j<5;j++);
        }
        void delayshort()
        {
        _nop_();
        _nop_();
        _nop_();
        _nop_();
        }
        //=========================================================================
        //============================1602寫指令函數(shù)===============================
        void writecmd(unsigned char a)
        {
        delay(100);
        lcdwritecmd=a;
        }
        //=========================================================================
        //============================1602寫數(shù)據(jù)函數(shù)===============================
        void writedata(char lcddata)
        {
        delay(10);
        ledwritedat=lcddata;
        }
        //=========================================================================
        //===========================1602顯示字符串據(jù)函數(shù)==========================
        void displaystring(unsigned char add,unsigned char n,char tab[])
        {
        unsigned char i;
        for(i=0;i {
        writecmd(add+i);
        writedata(tab[i]);
        delay(100);
        }
        }
        //=========================================================================
        //===========================I2C開始信號函數(shù)===============================
        void start()
        {

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

        }
        //=========================================================================
        //===========================I2C結(jié)束信號函數(shù)===============================
        void stop()
        {

        }
        //=========================================================================
        //===========================I2C從機等待應答信號函數(shù)=======================
        void waitack()
        {

        }
        //=========================================================================
        //===========================I2C主機應答信號函數(shù)===========================
        void mack()
        {

        }
        //=========================================================================
        //===========================I2C寫一個字節(jié)函數(shù)=============================
        void write_byte(unsigned char a)
        {

        }
        //=========================================================================
        //===========================I2C讀一個字節(jié)函數(shù)=============================
        unsigned char read_byte()
        {

        }
        //=========================================================================
        //===========================PCF8583寫函數(shù)=================================
        //參數(shù)adr:寄存器地址
        //參數(shù)dat:寫入得數(shù)據(jù)
        void PCF8583_write(unsigned char adr,unsigned char dat)
        {
        start();
        write_byte(0xa0);
        waitack();
        write_byte(adr);
        waitack();
        write_byte(dat);
        waitack();
        stop();
        }
        //=========================================================================
        //===========================PCF8583讀函數(shù)=================================
        //連續(xù)讀區(qū)以00起始地址的7個單元的數(shù)據(jù)
        void PCF8583_read()
        {
        start();
        write_byte(0xA0);
        waitack();
        write_byte(0x00);
        waitack();
        stop();
        start();
        write_byte(0xA1);
        waitack();
        state = read_byte(); // 讀狀態(tài)寄存器的值
        mack();
        hudsec = read_byte(); // 讀百分之一秒數(shù)值寄存器的值
        mack();
        sec = read_byte(); // 讀秒數(shù)值寄存器的值
        mack();
        min = read_byte(); // 讀分數(shù)值寄存器的值
        mack();
        hour = read_byte(); // 讀時數(shù)值寄存器的值
        mack();
        day = read_byte(); // 讀天數(shù)值寄存器的值
        mack();
        mon = read_byte(); // 讀時月值寄存器的值
        mack();
        stop();

        }


        上一頁 1 2 下一頁

        關(guān)鍵詞: PCF8583LM1602protues仿

        評論


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

        關(guān)閉