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

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

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

      新聞中心

      EEPW首頁 > 嵌入式系統(tǒng) > 設(shè)計應用 > PIC:讀寫24LCxx系列的EEPROM的實例C語言程序

      PIC:讀寫24LCxx系列的EEPROM的實例C語言程序

      作者: 時間:2011-05-06 來源:網(wǎng)絡 收藏

      //*
      //***********************************************
      void EE_SEQU_Read(unsigned char ctrl,unsigned char addr,unsigned char length,unsigned char *dptr)
      {
      IdleI2C(); // ensure module is idle
      StartI2C(); // Start condition
      I2C_Done(); // Wait Start condition completed

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

      WriteI2C(ctrl); // Write Control to
      while(SSPCON2bits.ACKSTAT); // test for ACK condition, if received
      I2C_Done(); // Clear SSPIF flag

      WriteI2C(addr); // Write Address to
      while(SSPCON2bits.ACKSTAT); // test for ACK condition, if received
      I2C_Done(); // Clear SSPIF flag

      RestartI2C(); // initiate Restart condition
      I2C_Done();

      WriteI2C(ctrl+1); // Write Control to
      while(SSPCON2bits.ACKSTAT); // Test for ACK condition, if received
      I2C_Done(); // Clear SSPIF flag

      while (length!=0)
      {
      *dptr=ReadI2C(); // Enable I2C Receiver Store EEPROM data to Point buffer
      I2C_Done();
      dptr++;
      length--;

      if (length==0) NotAckI2C();
      else AckI2C(); // Continue read next data, send a acknowledge to EEPROM

      I2C_Done();
      }

      StopI2C(); // send STOP condition
      I2C_Done(); // wait until stop condition is over
      }

      //***********************************************
      //* Check I2C action that is completed *
      //***********************************************
      void I2C_Done(void)
      {
      while (!PIR1bits.SSPIF); // Completed the action when the SSPIF is Hi.
      PIR1bits.SSPIF=0; // Clear SSPIF
      }

      //************************************************
      //* Initial I2C Master Mode with 7 bits Address *
      //* Clock Speed : 100KHz @4MHz *
      //************************************************
      void Initialize_I2C_Master(void)
      {
      OpenI2C(MASTER,SLEW_ON);
      SSPADD= 9;
      }

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



      上一頁 1 2 3 下一頁

      評論


      相關(guān)推薦

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

      關(guān)閉