女人自慰AV免费观看内涵网,日韩国产剧情在线观看网址,神马电影网特片网,最新一级电影欧美,在线观看亚洲欧美日韩,黄色视频在线播放免费观看,ABO涨奶期羡澄,第一导航fulione,美女主播操b

0
  • 聊天消息
  • 系統(tǒng)消息
  • 評論與回復(fù)
登錄后你可以
  • 下載海量資料
  • 學(xué)習(xí)在線課程
  • 觀看技術(shù)視頻
  • 寫文章/發(fā)帖/加入社區(qū)
會員中心
創(chuàng)作中心

完善資料讓更多小伙伴認識你,還能領(lǐng)取20積分哦,立即完善>

3天內(nèi)不再提示

如何使用MAX2990 I2C接口編寫工業(yè)標準EEPROM

星星科技指導(dǎo)員 ? 來源:ADI ? 作者:ADI ? 2023-01-12 09:48 ? 次閱讀
加入交流群
微信小助手二維碼

掃碼添加小助手

加入工程師交流群

文章和固件代碼示例介紹了如何使用MAX2990電力線通信調(diào)制解調(diào)器上的IC接口與外部EEPROM 24C04接口。

介紹

本應(yīng)用筆記和固件代碼示例描述了MAX2990電力線通信調(diào)制解調(diào)器上的IC接口如何與外部EEPROM 24C04接口。IC總線由MAX2990(主機)控制,24C04 EEPROM由從機控制。下面的示意圖顯示了此示例中使用的硬件配置。

pYYBAGO_ZwuANZftAAAYjLb2-sA586.gif?imgver=1

固件說明

IC接口初始化

每當(dāng)使能IC模塊時,SCL和SDA必須配置為漏極開路。此配置是IC通信正常運行所必需的。由于IC是GPIO端口的替代功能,固件必須確保在初始化期間禁用SCL和SDA輸入上的上拉(通過將零寫入該端口控制器輸出位)。

該示例具有 250kHz 時鐘頻率。首先,需要在MAX2990中設(shè)置IC接口,如下所示:

PO1_bit.Bit2 = 0; 		// Disables the GPIO function of the
PO1_bit.Bit3 = 0; 		// I2C pins

I2CCN_bit.I2CEN = 0; 	// Makes sure that I2C is disabled
			// to allow the changing of the I2C settings

I2CCN_bit.I2CMST = 1; 		// Sets the I2C engine to master mode
I2CCN_bit.I2CEA = 0; 		// 7-bit address mode
I2CCK_bit.I2CCKL = 0x40; 	// 2μs CLK-low, to define I2C frequency
I2CCK_bit.I2CCKH = 0x40; 	// 2μs CLK-high, to define I2C frequency

I2CTO = 200; 		// I2C_TIMEOUT
I2CST = 0x400; 		// Resets I2C status register

I2CCN_bit.I2CEN = 1; 		// Enables the I2C engine

寫入模式

要寫入 24C04 EEPROM,必須通過 IC 接口寫入以下字節(jié):

IC EEPROM 的地址(在本例中0xA0)

EEPROM 中存儲器位置的地址

數(shù)據(jù)字節(jié)(地址將自動增加)

在此示例中,我們嘗試從位置0x00開始將以下字節(jié)寫入EEPROM:0x12,0x34,0x56,0x78和0x90。

i2c_init_write(); 	// Sets the MAX2990 I2C Engine into write mode
i2c_write(0x50); 	// 24C04 write (adr = 0b1010 000 0) = 0xA0
			// The MAX2990 I2C engine shifts the I2C address by
			// 1 bit, because it will generate the R/W bit
			// automatically

i2c_write(0x00); 	// word address location
i2c_write(0x12); 	// data1
i2c_write(0x34); 	// data2
i2c_write(0x56); 	// data3
i2c_write(0x78); 	// data4
i2c_write(0x90); 	// data5
I2C_STOP; 		// Sends I2C stop-condition

poYBAGO_Zw2AcV04AAArexTx28c660.gif?imgver=1

閱讀模式

為了回讀數(shù)據(jù),我們從EEPROM寫入。重要的是,我們要給 24C04 足夠的時間來編寫。這通常需要在“停止條件”后的幾毫秒內(nèi)。請查閱IC的數(shù)據(jù)手冊,確保使用正確的時序。

i2c_init_write(); 	// Sets the MAX2990 I2C engine into write mode
i2c_write(0x50); 	// 24C04 write (adr = 0b1010 000 0) = 0xA0
			// The MAX2990 I2C engine shifts the I2C address by
			// 1 bit, because it will generate the R/W bit
			// automatically

i2c_write(0x00); 	// word address location

i2c_init_read(); 	// Sets the MAX2990 I2C engine into read mode

i2c_write(0x50); 	// 24C04 read (adr = 0b1010 000 1) = 0xA1
			// The MAX2990 I2C engine shifts the I2C address by
			// 1 bit, because it will generate the R/W bit
			// automatically

unsigned char data[5]; 		// Array to store the received data
i2c_read(data[0]); 		// Reads 1 byte from I2C and writes it to the array
i2c_read(data[1]); 		// Reads 1 byte from I2C and writes it to the array
i2c_read(data[2]); 		// Reads 1 byte from I2C and writes it to the array
i2c_read(data[3]); 		// Reads 1 byte from I2C and writes it to the array
i2c_read(data[4]); 		// Reads 1 byte from I2C and writes it to the array
I2C_STOP; 			// Sends I2C stop-condition

現(xiàn)在我們檢查以下用于讀取和寫入EEPROM的函數(shù)。

i2c_init_write(void)
i2c_init_read(void)
i2c_write(UINT8 data)
i2c_read(UINT8 *data)

pYYBAGO_ZxCAErhmAABO0Okhm0E415.gif?imgver=1

void i2c_init_write(void)
{
I2CCN_bit.I2CMODE = 0; 	// I2C transmit mode
I2CCN_bit.I2CACK = 1; 	// Creates I2C NACK so that slave can create ACK
I2C_START; 		// Generates I2C START condition
while( I2CCN_bit.I2CSTART == 1 ); 	// Waits until the START condition
					// was put to the I2C bus
I2CST_bit.I2CSRI = 0; 			// Resets the I2C interrupt flag
}

int i2c_init_read(void)
{
I2CCN_bit.I2CMODE = 1; 	// I2C read-mode
I2CCN_bit.I2CACK = 0; 	// Creates I2C ACK after receive
I2C_START; 		// Generates I2C START condition

while( I2CCN_bit.I2CSTART == 1 ); 	// Waits until the START condition
I2CST_bit.I2CSRI = 0; 			// Resets the I2C interrupt flag
}

void i2c_write(UINT8 data)
{
I2CBUF = data; 				// Puts the data on the I2C bus
while( I2CST_bit.I2CTXI == 0 ); 	// Waits for transfer complete
I2CST_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 zeros

while( !I2CST_bit.I2CRXI ); 		// Waits for receive complete
I2CST_bit.I2CRXI=0; 			// Resets the I2C receive complete
					// interrupt flag

*data = I2CBUF; 			// Writes the data to the pointer
}

審核編輯:郭婷

聲明:本文內(nèi)容及配圖由入駐作者撰寫或者入駐合作網(wǎng)站授權(quán)轉(zhuǎn)載。文章觀點僅代表作者本人,不代表電子發(fā)燒友網(wǎng)立場。文章及其配圖僅供工程師學(xué)習(xí)之用,如有內(nèi)容侵權(quán)或者其他違規(guī)問題,請聯(lián)系本站處理。 舉報投訴
  • 調(diào)制解調(diào)器

    關(guān)注

    3

    文章

    874

    瀏覽量

    39605
  • 總線
    +關(guān)注

    關(guān)注

    10

    文章

    2959

    瀏覽量

    89730
  • 代碼
    +關(guān)注

    關(guān)注

    30

    文章

    4900

    瀏覽量

    70697
收藏 人收藏
加入交流群
微信小助手二維碼

掃碼添加小助手

加入工程師交流群

    評論

    相關(guān)推薦
    熱點推薦

    LTC2990-I2C溫度、電壓和電流監(jiān)視器

    LTC2990描述 LTC®2990用于監(jiān)視系統(tǒng)溫度、電壓和電流。該器件可通過I2C串行接口進行配置,以測量內(nèi)部溫度、遠端溫度、遠端電壓、
    發(fā)表于 12-09 16:06 ?4355次閱讀

    MAX2990 pdf

    The MAX2990 power line communication (PLC) base- band modem delivers a cost-effective
    發(fā)表于 06-30 13:41 ?87次下載

    AN979使用手冊,I2C™串行EEPROM與P

    AN979使用手冊,I2C™串行EEPROM與PIC18器件接口設(shè)計 Microchip Technology 的24LCXXB串行EEPROM器件與
    發(fā)表于 03-04 11:09 ?16次下載

    MAX2990 Integrated Power-Line

    This programming manual describes the chip architecture and programming capabilities of the MAX2990
    發(fā)表于 07-24 12:09 ?17次下載

    如何通過MAX2990 I2C接口標準EEPROM (24

      引言   本文介紹了如何通過MAX2990電力線通信調(diào)制解調(diào)器的
    發(fā)表于 10-22 11:32 ?1663次閱讀
    如何通過<b class='flag-5'>MAX2990</b> <b class='flag-5'>I2C</b><b class='flag-5'>接口</b>向<b class='flag-5'>標準</b><b class='flag-5'>EEPROM</b> (24

    使用硬件模塊實現(xiàn)8051 MCU與I2C?串行EEPROM接口

    本文檔內(nèi)容介紹了基于使用硬件模塊實現(xiàn)8051 MCU與I2C串行EEPROM接口,供參考
    發(fā)表于 03-29 15:03 ?1次下載

    I2C串行EEPROM與PIC18器件接口設(shè)計的詳細中文資料概述

    Microchip Technology的24LCXXB串行EEPROM器件與 I2C? 兼容,支持標準的 100 kHz 和 400 kHz 快速模式。當(dāng)設(shè)計中采用串行 EEPROM
    發(fā)表于 06-29 10:25 ?12次下載
    <b class='flag-5'>I2C</b>串行<b class='flag-5'>EEPROM</b>與PIC18器件<b class='flag-5'>接口</b>設(shè)計的詳細中文資料概述

    STM32F10x _硬件I2C讀寫EEPROM(標準外設(shè)庫版本)

    STM32F10x_硬件I2C讀寫EEPROM(標準外設(shè)庫版本)
    的頭像 發(fā)表于 03-25 11:11 ?1.1w次閱讀
    STM32F10x _硬件<b class='flag-5'>I2C</b>讀寫<b class='flag-5'>EEPROM</b>(<b class='flag-5'>標準</b>外設(shè)庫版本)

    使用MSSP模塊進行I2C串行EEPROM與PIC16器件的接口設(shè)計

    使用MSSP模塊進行I2C串行EEPROM與PIC16器件的接口設(shè)計說明。
    發(fā)表于 05-11 10:14 ?16次下載

    使用MSSP模塊進行I2C串行EEPROM與PIC18器件的接口設(shè)計

    使用MSSP模塊進行I2C串行EEPROM與PIC18器件的接口設(shè)計說明。
    發(fā)表于 05-11 10:23 ?11次下載

    I2C串行EEPROM與PICmicro單片機的接口設(shè)計

    I2C串行EEPROM與PICmicro單片機的接口設(shè)計說明。
    發(fā)表于 05-11 10:24 ?7次下載

    如何使用 MAX2990 I2C 接口編寫工業(yè)標準 EEPROM (24C04)

    發(fā)表于 11-17 12:42 ?0次下載
    如何使用 <b class='flag-5'>MAX2990</b> <b class='flag-5'>I</b>2<b class='flag-5'>C</b> <b class='flag-5'>接口</b><b class='flag-5'>編寫</b><b class='flag-5'>工業(yè)</b><b class='flag-5'>標準</b> <b class='flag-5'>EEPROM</b> (24<b class='flag-5'>C</b>04)

    如何使用I2C EEPROM

    電子發(fā)燒友網(wǎng)站提供《如何使用I2C EEPROM.zip》資料免費下載
    發(fā)表于 02-03 09:53 ?0次下載
    如何使用<b class='flag-5'>I2C</b> <b class='flag-5'>EEPROM</b>

    EEPROM接口的選擇方法

    接口的選擇方法 EEPROM的常規(guī)接口有3個分別是Microwire和SPI與I2C。 這些接口各自具有技術(shù)特點。 請選擇符合客戶需求的
    的頭像 發(fā)表于 07-12 17:37 ?1914次閱讀

    CW32單片機I2C接口讀寫EEPROM芯片介紹

    CW32單片機I2C接口讀寫EEPROM芯片介紹
    的頭像 發(fā)表于 11-09 17:42 ?1547次閱讀
    CW32單片機<b class='flag-5'>I2C</b><b class='flag-5'>接口</b>讀寫<b class='flag-5'>EEPROM</b>芯片介紹