在线看毛片网站电影-亚洲国产欧美日韩精品一区二区三区,国产欧美乱夫不卡无乱码,国产精品欧美久久久天天影视,精品一区二区三区视频在线观看,亚洲国产精品人成乱码天天看,日韩久久久一区,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>

            新聞中心

            EEPW首頁(yè) > 嵌入式系統(tǒng) > 設(shè)計(jì)應(yīng)用 > C8051F330 16*16點(diǎn)陣(SPI 、SMBus、I2C)PCF8563

            C8051F330 16*16點(diǎn)陣(SPI 、SMBus、I2C)PCF8563

            作者: 時(shí)間:2016-11-30 來(lái)源:網(wǎng)絡(luò) 收藏

            /****************初始化檢測(cè)pcf8563****************/

            本文引用地址:http://www.biyoush.com/article/201611/324045.htm

            pio_int();
            TIME01_INT();
            TIME2_INT();
            TIME3_INT();
            SPI_INT(); //SPI0DAT是SPI的數(shù)據(jù)寄存
            SMB_INT();
            spit_time();
            EIE1|=0x01;
            EA=1;
            dat_int();

            led=0;

            TR0=0;
            delay(1000);
            write_pcf8563();

            while(1)
            {
            TR0=0;
            BUSY=0;
            read_pcf8563();
            spit_time();
            TR0=1;


            //Jump_Word(sg);
            //Jump_Word(sd);
            //Jump_Word(fg);
            //Jump_Word(fd);
            //Jump_Word(md);
            //M_Word(md);
            M_Word(4);
            delay(10*TIME);

            M_Words(TOTAL);

            UP_Run(TOTAL);

            M_Black();
            delay(10*TIME);

            L_Removeout(TOTAL);
            delay(3*TIME);

            M_Black();
            delay(10*TIME);


            R_Removeout(TOTAL);
            delay(3*TIME);

            }//總while循環(huán)的結(jié)束
            }//main函數(shù)的結(jié)束

            void t0(void) interrupt 1 //定時(shí)器0的中斷服務(wù)程序
            {
            register uchar m,n=BLKN;
            TH0 = 0xfc;
            TL0 = 0x18;
            m = CONIO;
            m = (++m)&0x0f;
            for(n=0;n{
            SPI0DAT = dispram[30-m*2+n];//dispram[((BLKN-)n/2+1)*30-m*2-(n/2)*30+n]
            while(!SPIF);
            SPIF=0;
            }
            CONIO &= 0xf0;
            CLK = 1;
            CONIO |= m;
            CLK = 0;
            scyx=1;

            }

            void SMBus_ISR (void) interrupt 7
            {
            bit FAIL = 0;

            if (ARBLOST == 0) //如果贏得總線
            {
            switch (SMB0CN & 0xF0) //確定中斷來(lái)源
            {
            case 0xe0: //主發(fā)送方式下產(chǎn)生開(kāi)始條件
            SMB0DAT = send;
            SMB0DAT &= 0xFE;
            SMB0DAT |= SMB_RW; //對(duì)發(fā)送的數(shù)據(jù)進(jìn)行處理
            STA = 0;
            break;

            case 0xc0: //主方式下發(fā)送
            if (ACK)
            {
            if (SMB_RW == 0)
            {
            if(send_number<=3)
            {
            if(control==0)
            {
            SMB0DAT = send;
            send_number+=5;
            }
            else
            {
            SMB0DAT = send1[send_number];
            send_number++;
            }
            }
            else
            {
            send_number=0;control=0;
            STO = 1;
            BUSY = 0;
            }
            }
            else {;} //BUSY=0
            }
            else
            {
            STO = 1;
            STA = 1;
            }
            break;


            case 0x80: //主方式下接收
            if (receive_number-1>0) //控制接收3個(gè)數(shù)據(jù)就結(jié)束
            {
            receive1[receive_number-1] = SMB0DAT;
            ACK = 1;
            receive_number--;
            }
            else
            {
            receive1[receive_number-1] = SMB0DAT;
            receive_number=3;
            BUSY = 0;
            ACK = 0;
            STO = 1;
            }
            break;

            default:
            FAIL = 1;
            break;
            }
            }

            else //輸?shù)艨偩€
            {
            FAIL = 1;
            }


            if (FAIL) //SMBUS通訊失敗后的處理
            {
            SMB0CF &= ~0x80;
            SMB0CF |= 0x80;
            STA = 0;
            STO = 0;
            ACK = 0;
            BUSY = 0;
            FAIL = 0;

            }

            SI = 0;
            }


            void T3_ISR() interrupt 14 //定時(shí)器3中斷服務(wù)程序 用于檢測(cè)SMBus是否超時(shí)
            {
            SMB0CF &= ~0x80;
            SMB0CF |= 0x80;
            TMR3CN &=~0x80;

            STA = 0;
            BUSY = 0;
            pcf8563_scl=1;
            }


            上一頁(yè) 1 2 3 下一頁(yè)

            評(píng)論


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

            關(guān)閉