<meter id="pryje"><nav id="pryje"><delect id="pryje"></delect></nav></meter>
          <label id="pryje"></label>

          新聞中心

          EEPW首頁 > 嵌入式系統(tǒng) > 設(shè)計(jì)應(yīng)用 > 通過MAX2990 I2C接口向標(biāo)準(zhǔn)EEPROM (24C04)連接的方法

          通過MAX2990 I2C接口向標(biāo)準(zhǔn)EEPROM (24C04)連接的方法

          作者: 時(shí)間:2012-02-21 來源:網(wǎng)絡(luò) 收藏

          現(xiàn)在,我們可以驗(yàn)證一下用于讀、寫操作的功能。

          本文引用地址:http://www.ex-cimer.com/article/172019.htm
          i2c_init_write(void)i2c_init_read(void)i2c_write(UINT8 data)i2c_read(UINT8 *data)

          void i2c_init_write(void){CN_bit.MODE = 0; //  transmit modeI2CCN_bit.I2CACK = 1; // Creates I2C NACK so that slave can create ACKI2C_START; 		// Generates I2C START conditionwhile( I2CCN_bit.I2CSTART == 1 ); 	// Waits until the START condition// was put to the I2C busI2CST_bit.I2CSRI = 0; 		// Resets the I2C interrupt flag}int i2c_init_read(void){I2CCN_bit.I2CMODE = 1; 	// I2C read-modeI2CCN_bit.I2CACK = 0; 	// Creates I2C ACK after receiveI2C_START; 		// Generates I2C START conditionwhile( I2CCN_bit.I2CSTART == 1 ); 	// Waits until the START conditionI2CST_bit.I2CSRI = 0; 		// Resets the I2C interrupt flag}void i2c_write(UINT8 data){I2CBUF = data; 			// Puts the data on the I2C buswhile( I2CST_bit.I2CTXI == 0 ); 	// Waits for transfer completeI2CST_bit.I2CTXI = 0; 		// Resets the I2C transmit complete// interrupt flag}void i2c_read(UINT8 *data){I2CBUF = 0xff; 	// Puts all ones on the I2C bus so that slave can pull// the bus down to generate zeroswhile( !I2CST_bit.I2CRXI ); 		// Waits for receive completeI2CST_bit.I2CRXI=0; 		// Resets the I2C receive complete// interrupt flag*data = I2CBUF; 			// Writes the data to the pointer}

          上一頁 1 2 下一頁

          評(píng)論


          相關(guān)推薦

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

          關(guān)閉
          看屁屁www成人影院,亚洲人妻成人图片,亚洲精品成人午夜在线,日韩在线 欧美成人 (function(){ var bp = document.createElement('script'); var curProtocol = window.location.protocol.split(':')[0]; if (curProtocol === 'https') { bp.src = 'https://zz.bdstatic.com/linksubmit/push.js'; } else { bp.src = 'http://push.zhanzhang.baidu.com/push.js'; } var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(bp, s); })();