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

<abbr id="27omo"></abbr>

<menu id="27omo"><dl id="27omo"></dl></menu>
    • <label id="27omo"><tt id="27omo"></tt></label>

      新聞中心

      EEPW首頁(yè) > 嵌入式系統(tǒng) > 設(shè)計(jì)應(yīng)用 > SPI總線(xiàn)驅(qū)動(dòng)(C語(yǔ)言源程序)

      SPI總線(xiàn)驅(qū)動(dòng)(C語(yǔ)言源程序)

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

      unsigned char eral_46()
      {
      data unsigned char temp1;
      data unsigned int temp2;
      cs_93=0;
      sk_93=0;
      //spi_org=1;
      cs_93=1;
      ewen46();
      _nop_();
      cs_93=1;
      _nop_();
      high46();
      wd46(0x20);
      wd46(0x20);
      cs_93=0;
      _nop_();
      cs_93=1;
      temp1=1;
      temp2=50000;
      while(!do_93)
      {
      temp2=temp2-1;
      if(temp2==0)
      {
      temp1=0;
      break;
      }
      }
      cs_93=0;
      return temp1;
      }


      unsigned int read93c46_word(unsigned char address)
      {
      unsigned int dat;
      unsigned char dat0,dat1;
      //gnd_93a=0;
      //gnd_93=0;
      cs_93=sk_93=0;
      //org_93=1;
      cs_93=1;_nop_();
      //address=address1;
      //address=address>>1;
      address=address|0x80;
      address=address|0x80;
      high46();
      wd46(address);
      dat1=rd46();
      dat0=rd46();
      cs_93=0;
      dat=dat1*256+dat0;
      return(dat);
      }
      bit write93c46_word(unsigned char address,unsigned int dat)
      {
      unsigned char e,time,temp=address;
      e=0;
      while (e3)
      {
      //gnd_93a=0;
      //gnd_93=0;
      cs_93=sk_93=0;
      org_93=1;
      cs_93=1;
      ewen46();
      _nop_();
      cs_93=1;
      _nop_();
      high46();
      address=1;//??
      address|=0x80;
      address>>=1;//??
      address|=0x40;
      wd46(address);
      wd46(dat/256);
      wd46(dat%256);
      cs_93=0;
      _nop_();
      cs_93=1;
      time=0;
      do_93=1;
      while (1)
      {
      if (do_93==1)
      break;
      if (time>20)
      break;
      time++;
      }
      cs_93=0;
      if (read93c46_word(temp)==dat)
      {
      return(0);
      }
      e++;
      }
      return(1);
      }
      /*-----------------------------------------------------
      93c57系列函數(shù)調(diào)用(舉例)
      調(diào)用方式:bit write93c57_word(unsigned int address,unsigned int dat) ﹫2001/05/12
      函數(shù)說(shuō)明:私有函數(shù),專(zhuān)用
      -----------------------------------------------------
      void ewen57(void)
      {
      _nop_();
      cs_93=1;
      dip7=0;
      high46();
      low46();
      wd46(0x60);
      cs_93=0;
      }
      unsigned int read93c57_word(unsigned int address)
      {
      unsigned int dat;
      unsigned char dat0,dat1;
      gnd_93=0;
      cs_93=sk_93=0;
      org_93=1;
      cs_93=1;
      address=address>>1;
      high46();
      high46();
      wd46(address);
      dat1=rd46();
      dat0=rd46();
      cs_93=0;
      dat=dat1*256+dat0;
      return(dat);
      }
      bit write93c57_word(unsigned int address,unsigned int dat)
      {
      unsigned char e;
      unsigned int temp=address;
      e=0;
      while (e3)
      {
      gnd_93=0;
      cs_93=sk_93=0;
      org_93=1;
      cs_93=1;
      ewen57();
      cs_93=1;
      _nop_();
      high46();
      low46();
      address>>=1;
      address|=0x80;
      wd46(address);
      wd46(dat/256);
      wd46(dat%256);
      cs_93=0;
      _nop_();
      cs_93=1;
      time=0;
      do_93=1;
      while (1)
      {
      if (do_93==1) break;
      if (time>20) break;
      }
      cs_93=0;
      if (read93c57_word(temp)==dat)
      {
      return(0);
      }
      e++;
      }
      return(1);
      }
      /*-----------------------------------------------------
      93c56系列函數(shù)調(diào)用(舉例)
      調(diào)用方式:bit write93c56_word(unsigned int address,unsigned int dat) ﹫2001/05/12
      函數(shù)說(shuō)明:私有函數(shù),SPI專(zhuān)用
      -----------------------------------------------------
      void ewen56(void)
      {
      _nop_();
      cs_93=1;
      high46();
      low46();
      low46();
      wd46(0xc0);
      cs_93=0;
      }
      unsigned int read93c56_word(unsigned char address)
      {
      unsigned int dat;
      unsigned char dat0,dat1;
      gnd_93=0;
      cs_93=sk_93=0;
      org_93=1;
      cs_93=1;
      address=address>>1;
      high46();
      high46();
      low46();
      wd46(address);
      dat1=rd46();
      dat0=rd46();
      cs_93=0;
      dat=dat1*256+dat0;
      return(dat);
      }
      bit write93c56_word(unsigned char address,unsigned int dat)
      {
      unsigned char e;
      unsigned int temp=address;
      e=0;
      while (e3)
      {
      gnd_93=0;
      cs_93=sk_93=0;
      org_93=1;
      cs_93=1;
      ewen56();
      _nop_();
      cs_93=1;
      _nop_();
      high46();
      low46();
      high46();
      address>>=1;
      wd46(address);
      wd46(dat/256);
      wd46(dat%256);
      cs_93=0;
      _nop_();
      cs_93=1;
      TH0=0;
      time=0;
      do_93=1;
      while (1)
      {
      if (do_93==1) break;
      if (time) break;
      }
      cs_93=0;
      if (read93c56_word(temp)==dat)
      {
      return(0);
      }
      e++;
      }
      return(1);
      }

      c語(yǔ)言相關(guān)文章:c語(yǔ)言教程


      晶振相關(guān)文章:晶振原理


      評(píng)論


      相關(guān)推薦

      技術(shù)專(zhuān)區(qū)

      關(guān)閉
      ×

      “芯”朋友见面大会
      珠海|11.14|泰克“芯”朋友见面大会珠海站|泰克带您从测试角度看半导体的整条产业链,快来报名抢位吧>>